MYSQL INSERT ID NOT WORKING


Posted on 16th Feb 2014 07:03 pm by admin

Code: $id = mysql_insert_id();
header("Location: ./?view=$id");
Why $id pulling blank nothing?

Did you know?Explore Trending and Topic pages for more stories like this.

Code: mysql_query("INSERT INTO `prays` (`title`,`prayer`,`time`,`level`,`nameid`,`name`) VALUES (
'". mysql_real_escape_string($_POST['title']) ."',
'". mysql_real_escape_string($text) ."',
'". mysql_real_escape_string($time) ."',
'". mysql_real_escape_string($_POST['level']) ."',
'". mysql_real_escape_string($e) ."',
'". mysql_real_escape_string($name) ."');") or die(mysql_error()) ;
mysql_close();
$id = mysql_insert_id();
header("Location: ./?view=$id");
No comments posted yet

Your Answer:

Login to answer
83 Like 9 Dislike
Previous forums Next forums
Other forums

New to Arrays
Hi I am new to PHP (a week and a half now) and I am just beginning to read about arrays. I understan

Simple code help with redirects
I am trying to figure out a redirect script that detects if the browser is IE 7 and if it does, redi

How to ask a regex question?
Hi, I thought I'd share some of my insight after seeing too many bad questions that either get ignor

HTML form problem
Ive made a form to that i want to send to my email via PHP. but when it send only the name's etc sen

PHP error. Need help urgently
Hi,

I am programming a php site and have a problem that i just cant find out how to fix. When

PHP - MySQL Fail
My PHP code will only execute the first part of my code...

Code: <?php

sessio

Undefined index: username HELP NEWBIE
I am trying a simple login/logout for my website. It works well with checking if the username exists

Can't find the problem (no error message)!
OK, here's the deal. This code is really weirdly formatted (sorry!) and hard to understand, so I'm g

need to apply an if/else statement to Tim Thumb script
Not sure how to work this. I essentially want to call a variety of image sizes based on which style

send message to the java application
Oracle 10g with Windows platform.

I have a java application that periodically pings the d

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash