Sponsored by NuSphere - PHP Software for PHP Application Developers - On Sale This Week for $100



Go Back   PHP-Editors > Linux, Apache, MySQL > MySQL Help

MySQL Help Post any question relating to MySQL here and hopefully someone can help

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 2008-03-10, 03:13 AM
Junior Member
 
Join Date: Mar 2008
Posts: 4
som3aa is on a distinguished road
Default Help me please!

I am a beginner so my question is probably toooo easy for you
please someone help me
I am using dreamweaver to create a new website.
i am trying to host a new website on a shared server.
i created a new database and tables using phpmyadmin.
i connected to the database using dreamweaver and i created a new page called firsttest.php and saved it in public_html/php then i created a new recordset and tried to link it to firsttest.php

when i ran on the hosting server i got this error:

Warning: main(../Connections/test.php) [function.main]: failed to open stream: No such file or directory in /home/som3aa/public_html/php/firsttest.php on line 1

Fatal error: main() [function.require]: Failed opening required '../Connections/test.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/som3aa/public_html/php/firsttest.php on line 1

test is the name of my database
The problem is that it can't locate the database itself, i don't know where is it stored (i just created it with phpmyadmin).
in cpanel i opened php pear.
it says

You will need to add /home/som3aa/php to the include path.
You can do this by adding the following code to your script: ini_set("include_path", '/home/som3aa/php:' . ini_get("include_path") );


all i need to do is type in firsttest.php {Recordset1.Username} for example and i want it to read the name from the database instead it gives me an error that it can't locate the databasePlease guys someone help meThanx in advance guys

Last edited by som3aa; 2008-03-10 at 03:16 AM.
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 2008-03-10, 02:04 PM
Xnuiem's Avatar
Senior Member
 
Join Date: May 2004
Location: DFW, Texas
Posts: 1,096
Xnuiem will become famous soon enough
Send a message via Yahoo to Xnuiem
Default

The problem here actually isnt MySQL, yet. PHP cant find the file it needs, the test.php.

Why dont you post what you have in firsttest.php and test.php and then where they are in the directories. That may give us the chance to really see what is going on.
__________________
I rarely give code examples.
No, I have never used IIS or Windows of any kind as a web server. Get a real OS!
Please don't PM me, I won't respond.
Reply With Quote
  #3 (permalink)  
Old 2008-03-10, 03:40 PM
Junior Member
 
Join Date: Mar 2008
Posts: 4
som3aa is on a distinguished road
Default

Quote:
Originally Posted by Xnuiem View Post
The problem here actually isnt MySQL, yet. PHP cant find the file it needs, the test.php.

Why dont you post what you have in firsttest.php and test.php and then where they are in the directories. That may give us the chance to really see what is going on.
Thank you very much xnuiem for ur response.
yes it can't find the file test.php , the problem is that there is no test.php in the first place.
Here is what i did
i created a new page called firsttest.php then in dreamweaver i pressed "+" ==> Mysql connection . then i wrote in connection name :"test" and filled in the rest and in databases i chose my database which is located on the remote server (i don't know where is it stored exactly that's the problem , i can't see any stored files , i created it with phpmyadmin) in dreamweaver i can see the database and the tables , so i chose it(2 files where uploaded to my remote server in /public_html/_mmServerScripts called mysql.php and MMHTTPDB.php

and then created a recordset from the tables inside it , so this code was generated in firsttest.php

Code:
<?php require_once('../Connections/test.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}
mysql_select_db($database_test, $test);
$query_Recordset1 = "SELECT * FROM login";
$Recordset1 = mysql_query($query_Recordset1, $test) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="XHTML namespace">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>
i think the problem is here
Code:
<?php require_once('../Connections/test.php'); ?>
this folder is emtpy and i don't know where is test.php , i don't even know if there is a file which is called test.php , test is just the name of the connection.

Hope you can help me
Thank you very much m8

Last edited by som3aa; 2008-03-10 at 03:43 PM.
Reply With Quote
  #4 (permalink)  
Old 2008-03-10, 04:05 PM
Junior Member
 
Join Date: Mar 2008
Posts: 4
som3aa is on a distinguished road
Default

Continue:
sorry i can't edit my post so i will continue here

check this site:

Factsheet 19: How can I link my web pages to a database? PHP and MySQL

This is exactly what i did,the only difference is that im using dreamweaver cs3

Quote:
Dreamweaver MX will then automatically insert the PHP code for this query into your web page.
This is the problem , it creates the code but the code tries to connect to a wrong location.
i did all the previous steps and i can browse the tables i created and everything

Hope you can help me
Thank you
Reply With Quote
  #5 (permalink)  
Old 2008-03-10, 04:21 PM
Junior Member
 
Join Date: Mar 2008
Posts: 4
som3aa is on a distinguished road
Default

omgggggggggggggggggggggggggggggggggggggg

PROBLEM SOLVED!!!!!!!!!!!!!!!!!!!

u know man i spent like more than 7-8 hours on this problem alone!!!!!!!!!!!!!!


u know whose fault was it??????????????

it turned out to be dreamweavers fault since it didn't upload the file test.php automatically to my server!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!


i can't believe that the problem is solved!!!!!!!!!!!!!!

Thank you veryyyyyyyyyyyyyyyyyyyyyy much man for ur response , i looked everywhere on the server for this file but i couldn't find it and at the end it was on my computer lol
Reply With Quote
  #6 (permalink)  
Old 2008-03-11, 11:42 PM
Xnuiem's Avatar
Senior Member
 
Join Date: May 2004
Location: DFW, Texas
Posts: 1,096
Xnuiem will become famous soon enough
Send a message via Yahoo to Xnuiem
Default

LOL, and people wonder why I code everything by hand.

Glad you got it fixed, and thank you for posting your resolution. Always good for others to see the problems and how to fix them.

If you find another problem, come on back.
__________________
I rarely give code examples.
No, I have never used IIS or Windows of any kind as a web server. Get a real OS!
Please don't PM me, I won't respond.
Reply With Quote
Must read Review for Serious PHP Developers


NuSphere PhpED 5.0 : The Staff of php-editors.com recently spent a few days working with NuSphere PhpED 5.0 (a popular PHP IDE) and NuCoder 1.4 (a PHP Encoding Utility), read up on all the details.

Sponsored Links
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 01:06 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0
© Copyright 2003-2008 www.php-editors.com. The ultimate PHP Editor and PHP IDE site.