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)); 

sprintf manual


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

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -