Basically this was working except when I tried to write the user submitted post into the database. No errors appear or anything, just a blank page. I’ve written some if/else statements to try and just get ANYTHING to appear but it’s a no go. What am I missing?
I know that the sql connection is correct because I’ve tested it before.
You are using PHP to build an SQL string. Did PHP do what you expected?
add this line:
echo $insertionToDatabase;
Look at the output very carefully, paste it into your database via your db management tool. Was it a valid SQL statement or not?
If no, then work backwards, echo out the PHP variables all the way back to the form if necessary - and check the syntax of your sql statement again.
If it was a valid SQL statement, then work forwards – why did it not reach your database? Double check your connections again, just because they used to work does not mean they still do. Hardcode the details into the script temporarily to identify what is going wrong where.
The issue is NOTHIGN is appearing. No text at all. Even if I hardcode HTML into the page.
I tried both suggestions but still nothign is appearing.
I go to blog.php, type in some random nonsense and hit submit. Upon it coming to checkInfo.php, it’s a blank page. Even no HTML shows up in the source.
i don’t do php, but i think your $insertionToDatabase needs some kind of quotes around the entire sql string, and also, don’t you need to run it into the mysql_query function?
anyhow, test the query outside of php first, to make sure it’s working
I don’t think my SQL insertion is working. I narrowed it down to my SQL insertion variable as being the cause for stuff not showing up.
Even if I go to INSERT in PHPmyadmin to give me a basic outline of the insertion SQL query, even when I copy that into my PHP file, it doesn’t work.
Basically I have four rows in my table userSubmittedData (in table blog) and the first row is auto incremented, second row is date, then time, then the actual content of the blog post.
INSERT INTO blog.userSubmitted (PostNumber, Date, Time, Content) VALUES (NULL, ‘2012-02-15’, CURRENT_TIMESTAMP, ‘thisisapost’);
That’s an example SQL query I got when I manually inserted something. It came with the ticks.