Jump to content

can anyone heklp with this error


davieboy

Recommended Posts

[php:1:d0ebbc1c4e]<?php

 

include \"config.php\";

 

$db= mysql_connect($db_host,$db_user,$db_pass) or die (mysql_error());

mysql_select_db ($db_name) or die (mysql_error());

//now connected to the database

// add the clients details

$id = $_GET[\'id\'];

$query = mysql_query(\"SELECT name, place, fdesc, address, tele, fax, email, url, img FROM clients WHERE id = \'$id\'\");

mysql_query($query) or die (mysql_error());

while($r=mysql_fetch_array($result))

{

$name=$r[\"name\"];

$address=$r[\"address\"];

$place=$r[\"place\"];

$fdesc=$r[\"fdesc\"];

$tele=$r[\"tele\"];

$fax=$r[\"fax\"];

$email=$r[\"email\"];

$url=$r[\"url\"];

$img=$r[\"img\"];

echo \"<TABLE>

<tr>

<td>$name</td>

</td>

<tr>

<td>$address</td>

</tr>

<tr>

<td>$place</td>

</tr>

<tr>

<td>$fdesc</td>

</tr>

<tr>

<td>$tele</td>

</tr>

<tr>

<td>$fax</td>

</tr>

<tr>

<td>$email</td>

</tr>

</table>\";

}

mysql_close($db);

 

?>

 

[/php:1:d0ebbc1c4e]

 

i keep getting the error:

You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near \'Resource id #4\' at line 1

 

anyone able to help on it??

Link to comment
https://forums.phpfreaks.com/topic/562-can-anyone-heklp-with-this-error/
Share on other sites

[php:1:c54a50d13b]<?php

 

include \\\"config.php\\\";

 

$db= mysql_connect($db_host,$db_user,$db_pass) or die (mysql_error());

mysql_select_db ($db_name) or die (mysql_error());

//now connected to the database  

// add the clients details

$id = $_GET[\'id\'];

$query = mysql_query(\\\"SELECT name, place, fdesc, address, tele, fax, email, url, img FROM clients WHERE id = \'$id\'\\\");

mysql_query($query) or die (mysql_error());

while($r=mysql_fetch_array($result))

{

$name=$r[\\\"name\\\"];

$address=$r[\\\"address\\\"];

$place=$r[\\\"place\\\"];

$fdesc=$r[\\\"fdesc\\\"];

$tele=$r[\\\"tele\\\"];

$fax=$r[\\\"fax\\\"];

$email=$r[\\\"email\\\"];

$url=$r[\\\"url\\\"];

$img=$r[\\\"img\\\"];

echo \\\"<TABLE>

<tr>

<td>$name</td>

</td>

<tr>

<td>$address</td>

</tr>

<tr>

<td>$place</td>

</tr>

<tr>

<td>$fdesc</td>

</tr>

<tr>

<td>$tele</td>

</tr>

<tr>

<td>$fax</td>

</tr>

<tr>

<td>$email</td>

</tr>

</table>\\\";

}

mysql_close($db);

 

?>

 

[/php:1:c54a50d13b]

 

i keep getting the error:

You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near \'Resource id #4\' at line 1

 

anyone able to help on it??

 

 

Hey!

 

Ya have got 2 mysql_queriez!!! One shouldabe sufficient!

>>>> $query = mysql_query(\"SELECT name, place, fdesc, address, tele, fax, email, url, img FROM clients WHERE id = \'$id\'\");

mysql_query($query) or die (mysql_error()); <<<<

This meanz mysql_query(mysql_query(\"xyz\")), and iz incorrect. Just erase mysql_query when defining the first variable.

So:

$query = \"SELECT name, place, fdesc, address, tele, fax, email, url, img FROM clients WHERE id = \'$id\'\";

 

and i think, it\'s not a bad idea, to define the var $result as well, as it so far has no meaning (i guess...)

So modify the row:

mysql_query($query) or die (mysql_error());

To:

$result=mysql_query($query) or die (mysql_error());

 

Hope i could help ya!

 

RespecT

[php:1:0a994e4f0a]

echo \"<TABLE>

<tr>

<td>$name</td>

</td>

<tr>

<td>$address</td>

</tr>

<tr>

<td>$place</td>

</tr>

<tr>

<td>$fdesc</td>

</tr>

<tr>

<td>$tele</td>

</tr>

<tr>

<td>$fax</td>

</tr>

<tr>

<td>$email</td>

</tr>

</table>\";

[/php:1:0a994e4f0a]

 

i want to add a php include to add a header to the table

a normal file that is the header of the rest of the site

 

D

Then what about doing a thing like this (a big table, to which 2 smaller tablez are embedded...) :::

 

echo\"

<table>

<tr>

<td>

<table>\";

include(\"banner.php\");

echo\" </table>

</td>

 

<td>

<table>

<tr>

<td>$name</td>

</tr>

<tr>

<td>$place</td>

</tr>

</table>

</td>

</tr>

</table>\";

 

Is this sufficient?

LOL... :D

 

I didn\'t know how lame ya are, and from where to start...

 

ALthough, ya wanted the banners to be on the left... now ya want it on the top... hmmm... perhaps i am just to tired to sense yer thoughts, so i wasn\'t degradin\' you by starting the education from the very start... :P

 

:wink: Byez

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.