ohdang888 Posted November 22, 2008 Share Posted November 22, 2008 In order for isers to see this particular page, they must be logged in, and $user must be set... so thats not thje root of this.. The problem is that even if they do not have a row in "settings", its not always inserting it. I set up it to get to see if there is a row, and if it does not, then to inset one. But its not always inserting it!! Any ideas? <?php $is = mysql_query("SELECT * FROM settings WHERE user_id='$user' ")or die(mysql_error()); if(mysql_num_rows($is) == 0){ mysql_query("INSERT INTO settings (`user_id`, `profile`, `profile_box_header`, `profile_box_border_width`, `profile_box_border_style`)VALUES('$user', 'everyone', 'My Links:', 'none', 'solid') ")or die(mysql_error()); } ?> Link to comment https://forums.phpfreaks.com/topic/133802-a-weird-problem/ Share on other sites More sharing options...
.josh Posted November 22, 2008 Share Posted November 22, 2008 so...where is $user coming from? Link to comment https://forums.phpfreaks.com/topic/133802-a-weird-problem/#findComment-696351 Share on other sites More sharing options...
ohdang888 Posted November 22, 2008 Author Share Posted November 22, 2008 $user is the logged in user, as set by my header.php I know it exists, b/c i echo it and it gives me my user_id Link to comment https://forums.phpfreaks.com/topic/133802-a-weird-problem/#findComment-696356 Share on other sites More sharing options...
.josh Posted November 22, 2008 Share Posted November 22, 2008 Okay well let me put it another way. The code you posted looks fine. So if there's a problem, it's somewhere else. And in order for us to help, we need to see some more code. Link to comment https://forums.phpfreaks.com/topic/133802-a-weird-problem/#findComment-696368 Share on other sites More sharing options...
revraz Posted November 22, 2008 Share Posted November 22, 2008 You said "not always", so you need to figure out under what condition is it not. Echo the query each time and you'll probably see why it doesn't. Link to comment https://forums.phpfreaks.com/topic/133802-a-weird-problem/#findComment-696391 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.