Simple MYSQL insert statement not working, what am i NOT seeing -
this have, super basic. still cant working :/
$connection = mysql_connect("localhost","root","") or die ("couldn't connect server"); $db = mysql_select_db("streetrider",$connection) or die ("couldn't select database"); $result = mysql_query(sprintf("insert video(id, parent_id, video, coverimage, ts_created, is_void) values('%s','%s','%s', '%s', '%s','%s')", $unique_id, $parent_id,$videodirectory,$imagedirectory, $ts_created, $is_void)); missing???? :(
ok guys if 1 of variables i'm storing equal works:
$videodirectory = 'uservideos/'.$unique_id;
when variable equal this, insert fails: $videodirectory = 'uservideos/'.$unique_id.'.mp4';
its puzzling , frustrating, thats figured out.video datatype varchar(50).
you have assigned columns %s
query
function have sprintf()
call in ? try
$result = mysql_query(sprintf("insert video(id, parent_id, video, coverimage, ts_created, is_void) values('%s','%s','%s', '%s', '%s','%s')", $unique_id, $parent_id,$videodirectory,$imagedirectory, $ts_created, $is_void));
please, don't use
mysql_*
functions in new code. no longer maintained and officially deprecated. see red box? learn prepared statements instead, , use pdo or mysqli - this article decide which. if choose pdo, here tutorial.
Comments
Post a Comment