Jump to content

Recommended Posts

I have a website where a user can create an account and log in to it (Made it off of a template). This part works fine but I want to add a new section to the mySQL table. I want this section to store a link submitted in an input box. I created a new section called 'background'(The purpose is for users to set their own background). All of the linking to the database is done. The form that I made to post the link is on line 370. The place I would like to echo background is around line 278 How would I apply this to my current code? index-4.php You can see it live at: jordan.comze.com

Edited by jordan443

Your issue is line 283, you can't do " '$background' ". You could try " '{$background}' ". Or to make it simpler abandon the whole switching html to php. Keep it in php

 

 

echo "<img src='".$background."'>" 
or
 

echo "<img src='{$background}' />" 

That is assuming you have the background link in your $_SESSION already, I'm not sure if you're asking how to save it to the database or not but if so something like

 

mysql_query("INSERT INTO Account (Background) Values ('{$Background}')");

 

Then you can access it later, is that what you are asking? Also I noticed you are saving your passwords with md5, if you're expecting other users besides a few close friends.

You should look into a different password hashing and use salts.

Edited by remenissions

All of the background related lines in the code I posted are for temporarily setting the background using POST. I haven't done anything between the background and mySQL (I haven't linked 'background' to the mySQL database)

Edited by jordan443

I added in what you suggested on line 113 and changed the name of the input box to 'background'. It doesn't seem to be working. Right now I just want to get the url of the image saved to the database. Heres what I did to line 113:

 

 
 
mysql_query(" INSERT INTO tz_members(usr,pass,email,regIP,dt,background)
VALUES(
 
'".$_POST['username']."',
'".md5($pass)."',
'".$_POST['email']."',
'".$_SERVER['REMOTE_ADDR']."',
NOW(),
'".$_POST["background"]."',
 
)");
Edited by jordan443

I tried that but none of it helped.

 

Are you sure? I can spot quite a few things that will output some errors for you to see.

 

If the error reporting really did nothing, then you need to next debug your code, to see what is going wrong and where.

 

I would display all the $_POST data on form submission, to make sure it is what you expect.

Then I would debug your query, to make sure it is what you expect and also check for query errors too.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.