Supplied Arguments Not Valid
Posted: Fri Sep 07, 2007 1:16 pm
Hi All
I hope someone can help. A little background..
I designed my site using PHP5 usining mysqli extentions enabled. All was fine until I came to host it where I found out the host I'm with does not have mysqli extentions enalbed and wont enalbe them. Therefore I've been tasked with redoing everything using mysql extentions. Heres what I've done....
I semi coloned the " extension=php_mysqli.dll" in my php.ini and removed the semi colon from "extension=php_mysql.dll"
I then set about changing the occurances of mysqli in my code and replaced it with mysql. Needless to say this didn't work. This throws up errors when I simply try to select all records from my database and show them in my page. The code below is basically how I select records and display them.
When I run this code the following errors are shown
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\PoppedLung\test.php on line 8
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\PoppedLung\test.php on line 12
I can tell that something is wrong with the way I execute the query but can't tell what?
Any help greatly appreciated!!
Thanks
Jax[/quote]
I hope someone can help. A little background..
I designed my site using PHP5 usining mysqli extentions enabled. All was fine until I came to host it where I found out the host I'm with does not have mysqli extentions enalbed and wont enalbe them. Therefore I've been tasked with redoing everything using mysql extentions. Heres what I've done....
I semi coloned the " extension=php_mysqli.dll" in my php.ini and removed the semi colon from "extension=php_mysql.dll"
I then set about changing the occurances of mysqli in my code and replaced it with mysql. Needless to say this didn't work. This throws up errors when I simply try to select all records from my database and show them in my page. The code below is basically how I select records and display them.
Code: Select all
<?php
$cxn = mysql_connect('localhost','root','password','database')
or die ("couldn't connect to server");
$query="SELECT * FROM table ORDER BY postdate DESC ";
$result=mysql_query($cxn,$query);
echo "<table align='center' cellpadding='5' border='0'>";
$counter=1;
while($row = mysql_fetch_assoc($result))
{
extract($row);
echo "<tr><td valign='center' width='5%' align='left'
style='font-weight: bold;
font-size: 1.2em'\n>";
if( $counter == 1 )
{
}
echo "field1</td>";
echo "<td>field2</td>";
echo "<td>field3</td>";
$counter++;
}
echo "</table>";
?>Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\PoppedLung\test.php on line 8
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\PoppedLung\test.php on line 12
I can tell that something is wrong with the way I execute the query but can't tell what?
Any help greatly appreciated!!
Thanks
Jax[/quote]