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

Strange array issue, never happened before.
mysql_fetch_array returns 1 array per call. Generally that's why it is inserted into a while statem

Problem related to Creation of PDF File?
Hi All,
I am facing a problem related to creation pdf file. when I am creating a pdf file of do

how do i display data on a page from mysql
1 - do i use this code at the top of each of my page i wish to only alow access if there as been a s

Sending UDP Raw socket
I truly need help on this. I am trying to write a test program that simulate a network environment

Multiple Pages
Hi. Im very new to php. I'm trying to create a basic login/registration page.

So I have a bas

Entering Data Problem
Code: $result = mysql_query("SELECT * FROM flights");
while ($row = mysql_fetch_array($

Nested (echoed) php running wrong script
Got a problem with a php website I'm creating.

In a nutshell, the first page is entirely html

mySQL and PHP search
Hello,
I am trying to code a project and ran into a brick wall with one of my pages. I am pretty

urldecode question
How would I format this line of code properly?

<?php echo urldecode($_GET['Title']); ?

Compare user input to flat file data
Help...Am a complete newbie to programming so my code is prolly quite long. Am trying to verify a us

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