UBB.Dev
Posted By: rocket99 PHP code to change a signature - 03/29/2005 7:22 AM
I need a php code to do the equivilent of this SQL command:

update w3t_Users set U_Signature = "<img src=http://www.myboard.com/ubbthreads/uploads/picture.jpg>" where U_Username = "troublemaker"

This works! Now when I try to convert that to PHP, phpmyadmin gives me the php equivilent of

$sql = 'update w3t_Users set U_Signature = "<img src=http://www.myboard.com/ubbthreads/uploads/picture.jpg>" where U_Username = "troublemaker"';

Which gives me a parse error. I tried replacing $sql with $query, same problem.
Posted By: JoshPet Re: PHP code to change a signature - 03/29/2005 8:44 AM
Not sure I follow - that query is correct, you can't do that with just PHP, you need to actually connect to a database send the query to the database. But if you're wanting to do it via ubbthreads, the script would:
- Need to include the library by including main.inc.php (so that it connects to your database, and knows all your database settings.
- Need to have a call to do_query (to actually perform the query).

Example for a 6.5.x forum:

Code
<br /><?<br />require("./includes/main.inc.php");<br /><br />$query = 'update w3t_Users set U_Signature = "<img src=http://www.myboard.com/ubbthreads/uploads/picture.jpg>" where U_Username = "troublemaker"';<br /><br />$dbh -> do_query($query,__LINE__,__FILE__);<br /><br />?><br />
Posted By: rocket99 Re: PHP code to change a signature - 03/29/2005 5:20 PM
Thanks - that worked. [beat head on desk] Need to include the library by including main.inc.php - Need to include the library by including main.inc.php - Need to include the library by including main.inc.php [/beat head on desk]
© UBB.Developers