Jessica
Staff Alumni-
Posts
8,968 -
Joined
-
Last visited
-
Days Won
41
Everything posted by Jessica
-
look up strpos(), str_replace().
-
I don't understand what you're saying. What is the problem? You want the information that DID pass validation to be saved in the session and put in hidden inputs? Why doesn't that work?
-
Uploading a texted file and inputting data into a data base
Jessica replied to rbrunner's topic in PHP Coding Help
Bosses ALWAYS know what they are talking about. Fo sho. -
I have two databases. One has a table items, and another has a table news. (example.) I want to connect to both in my script (in my config file, so at the beginning of every page.) When I connect to the first, and query the items table, it works fine. I can print out the results, so I know it worked. I then connect to the second, query the news table, and that works. If I try to connect to both at the beginning, the first connection gets replaced by the second. I used to be able to do this with different users, but after I switched servers I now have to use the same user and password to access both. Is that why this is not working? Any ideas how I can do this so I don't have to combine the databases? I cannot use a second user (I have already pleaded with (mt) and got a no.) (In reality, there are 4 databases and they are all very big, so I don't want to combine them if at all possible.) Sample Code: [code]<? $db_username = 'username'; $db_password = 'password'; $db_database = 'database_1'; $db_server = 'myhost'; $dbOrig = mysql_connect($db_server, $db_username, $db_password); if(!$dbOrig){ die('Could not connect: ' . mysql_error()); } mysql_select_db($db_database, $dbOrig); $db_database = 'database_2'; $dbMain = mysql_connect($db_server, $db_username, $db_password); if(!$dbMain){ die('Could not connect: ' . mysql_error()); } mysql_select_db($db_database, $dbMain); $sql = "SELECT * FROM items"; $rs = mysql_query($sql, $dbOrig); if($rs){ while ($row = mysql_fetch_array($rs)) { print_r($row); } }else{ die('Error: ' . mysql_error()); } $sql = "SELECT * FROM news"; $rs = mysql_query($sql, $dbMain); if($rs){ while ($row = mysql_fetch_array($rs)) { print_r($row); } }else{ die('Error: ' . mysql_error()); } ?>[/code] Output: Error: Table 'database_2.items' doesn't exist
-
Uploading a texted file and inputting data into a data base
Jessica replied to rbrunner's topic in PHP Coding Help
Why would you need to do that? Before asking if you can or can't do something, it's always best to TRY first. -
did you try printing out the session to be POSITIVE? :-P print_r($_SESSION)
-
What if? Did you try it?
-
Did you look up the function before asking that question? You'll need to save your error message to the session.
-
header('Location: ListInfo.php'); to display the info they put in, you'll need to save that info to the session, then use the HTML value="" attribute.
-
At the time of the if statement, you haven't defined $quota. Is your code out of order or something?
-
Uploading a texted file and inputting data into a data base
Jessica replied to rbrunner's topic in PHP Coding Help
Oh your foreach syntax is wrong. foreach($array AS $key=>$value) or foreach($array AS $value) -
how do I code to check for a duplicate key on mysql insert?
Jessica replied to cgchris99's topic in PHP Coding Help
If it's a primary key it won't let you insert it. -
The second line isn't valid afaik. Is totals set? echo it to make sure?
-
Did you try it? BTW: bust cup? wtf? another dating site based on looks? Woohoo!
-
Uploading a texted file and inputting data into a data base
Jessica replied to rbrunner's topic in PHP Coding Help
You're missing a ) in your foreach and a ; in the line below it. -
Google "CAPTCHA php tutorial". Amazing!
-
Last time I checked, 10 times 1 was 10. You need line breaks, like I said.
-
avatars/ would be a subfolder in temp Try your base path/avatars/.$username etc.
-
So what is the problem? Do you just want to break up the lines? [code]echo "$table x $cnt = ".($table * $cnt).'<br />';[/code]
-
I think you have to use $_POST not $_post. What does it print out? "Not right" doesn't help much.
-
image not showing with <? include("../header.php") ?>
Jessica replied to bickyz's topic in PHP Coding Help
Okay as I said, if it's JUST the images, you need to check the HTML source which is generated. Right click on the page, view source, and look at the image src="". If it's wrong, you need to fix that path. If you still can't get it, can I see the live example? -
Did you try it? HINT: You'll need to use $_POST['submit']
-
Not quite how it works. A file gets uploaded to the temp folder, and you need to move it. Read this tutorial: http://www.tizag.com/phpT/fileupload.php (There's not a good one here on PHP Freaks I can see, if there is someone correct me please!)
-
Do you mean you Can't see it? Are you moving it into a folder other than temp?
-
HELP! How to redirect visitor after form submssion?
Jessica replied to youngsuccess's topic in PHP Coding Help
I second, process on a seperate page, and then they'll be on another page for you.