Jump to content

Help with SQL Query and PHP (passing variables via URL)


seb213

Recommended Posts

[quote author=craygo link=topic=123868.msg512650#msg512650 date=1169672650]
That usually means the sql statement is wrong

put this in after the sql
[code]
$query_Recordset2 = "SELECT * FROM products_description
                    JOIN products ON products_description.products_id = products.products_id
                    WHERE products.products_id ='$pid'";
echo $query_Recordset2."<br>";[/code]

And post what the wuery is

Ray


[/quote]


or if you ment for me to put this on my actual page, this is what i get:

[color=red]SELECT * FROM products_description JOIN products ON products_description.products_id = products.products_id WHERE products.products_id ='278'

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /www/snackerz/html/bulke/products/index.php on line 8[/color]
All of you guys SAVED my fuckin DAY!

Special Thanks to :
[color=red]
The Little Guy

craygo

dgiberson[/color]

What happend was i wrote my QUERY wrong, i had the wrong realtaionship, so i took the query [color=red]dgiberson[/color] gave me, and modified that, and what the hell do you know, im back in business.

[color=green]$pid = $_REQUEST['products_id'];
This is what i needed  :

$query_Recordset2 = "SELECT * FROM products_description pd INNER JOIN products p ON pd.products_id = p.products_id WHERE p.products_id = $pid";[/color]

Thanks so much for your help.


good stuff, glad to help.... i really suggest creating your queries in phpMyAdmin or MySQL Query Browser first, cause it will return you a little more info versus running it in your php code, the standard not a valid argument error doesn't really help you troubleshoot the query. Then porting it to php becomes a snap

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.