View Full Version : Running SQl query using php file
Senti.Jatt
08-15-2009, 04:16 PM
How can i run sql query from a php file???
for example i want to update
UPDATE `user` SET `ipaddress` = '1.2.3.4.5' WHERE `userid` =1;
how can i run this in php file???
i need full code please
Lynne
08-15-2009, 05:13 PM
Take a look at other queries written in the vbulletin files and you should see the proper format to do that. Just doing a quick search in my vb directory for UPDATE gives me this (and tons of others) as an example:
$vbulletin->db->query_write("
UPDATE " . TABLE_PREFIX . "user
SET reputationlevelid = $sql
");
Using that as an example, you should be able to write out yours.
mad@Max
08-15-2009, 05:21 PM
somefile.php
<?php
require_once ('./global.php');
if ($_REQUEST['do'] == 'somedo')
{
$vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "user SET ipaddress = '1.2.3.4.5' WHERE userid = 1");
}
?>
somefile.php?do=somedo
Senti.Jatt
08-15-2009, 06:27 PM
^ thanks
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.