| | |
mysql_fetch_array random problem?
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jan 2007
Posts: 12
Reputation:
Solved Threads: 0
Hello all,
I have been using mysql_fetch_array to read data from a query to a php array so i can then use it on my webpage. Everything was going fine until now...
I cant see the problem with my code, but it keeps calling the or die() error handler when trying to get the array. here is the code:
the $pName variable is being passed to the sql statment fine and the mysql_query($sqlProject) statment isnt throwing any errors, but the mysql_fetch_array() is! it wont throw any mysql_error() messages in the die() handler, just a string to let me know something is wrong.
Does this mean its a php problem and not a mysql problem?
I am totally lost/confused with this... please help me!
thx
Mike
I have been using mysql_fetch_array to read data from a query to a php array so i can then use it on my webpage. Everything was going fine until now...
I cant see the problem with my code, but it keeps calling the or die() error handler when trying to get the array. here is the code:
PHP Syntax (Toggle Plain Text)
$sqlProject = "select * from project where ProjectName='.$pName.';"; $queryProject = mysql_query($sqlProject) or die("query Project error "); $workType= Array(); while($proj = mysql_fetch_array($queryProject) or die("error in fetch array")){
the $pName variable is being passed to the sql statment fine and the mysql_query($sqlProject) statment isnt throwing any errors, but the mysql_fetch_array() is! it wont throw any mysql_error() messages in the die() handler, just a string to let me know something is wrong.
Does this mean its a php problem and not a mysql problem?
I am totally lost/confused with this... please help me!
thx
Mike
Are you sure the query is returning results? Are the results an array?
print_r($sqlProject); so you know the query looks lik you think it should. Try running that query in phpMyAdmin and see what the results are, that may help you figure out what's going on.
You may need to add the resource link to the query: mysql_query($sqlProject, $link); This link is made using mysql_connect() so look for :
$somename = mysql_connect(login stuff...);
and then you wound want to have it:
$queryProject = mysql_query($sqlProject, $somename)...
print_r($sqlProject); so you know the query looks lik you think it should. Try running that query in phpMyAdmin and see what the results are, that may help you figure out what's going on.
You may need to add the resource link to the query: mysql_query($sqlProject, $link); This link is made using mysql_connect() so look for :
$somename = mysql_connect(login stuff...);
and then you wound want to have it:
$queryProject = mysql_query($sqlProject, $somename)...
![]() |
Similar Threads
- More problems with the comp. hanging in the POST, please help (Motherboards, CPUs and RAM)
- Outlook not receiving new mail (Windows NT / 2000 / XP)
- Help Page Error,Hijack log inside (Viruses, Spyware and other Nasties)
- Random problem... cant access passworded sites (Windows NT / 2000 / XP)
- PC going blank randonmly HELP (Windows NT / 2000 / XP)
Other Threads in the PHP Forum
- Previous Thread: PHP Quote form
- Next Thread: tidy
| Thread Tools | Search this Thread |
# 5.2.10 alexa apache api array beginner binary broken cakephp checkbox class clean clients cms code cron curl database date directory display dissertation dynamic echo echo$_get[x]changingitintovariable... email encode error fairness file files folder form forms function functions google href htaccess html image images include indentedsubcategory insert ip javascript joomla legislation limit link local login mail memberships menu mlm multiple multipletables mysql mysqlquery newsletters oop open paypal pdf persist php problem provider query radio random recursion remote rss script search server sessions simple sms sockets source space spam sql syntax system table tutorial update upload url validator variable video web youtube





