Jump to content

SQL not inserting


thecase

Recommended Posts

Hi,

 

Cant seem to figure out why this SQL line wont insert to the db

 

$query = sprintf("INSERT INTO raceadmin (username, matchid, text) VALUES ('%s', '%s', '%s')",	
            mysql_real_escape_string($username),
            mysql_real_escape_string($id),
            mysql_real_escape_string($text2));

 

Any ideas will be greatful

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/164167-sql-not-inserting/
Share on other sites

<?php

$query = "
INSERT INTO raceadmin
SET
	username = '%s', 
	matchid = '%s', 
	text = '%s'
";

$query = sprintf(
$query,	
mysql_real_escape_string($username),
mysql_real_escape_string($id),
mysql_real_escape_string($text2)
);

$result = mysql_query($query);

if (!$result)
{
die('Invalid query: ' . mysql_error());
}

Link to comment
https://forums.phpfreaks.com/topic/164167-sql-not-inserting/#findComment-866149
Share on other sites

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.