|
|
|
|
![]() ![]() |
Jan 7 2005, 09:18 PM
Post
#11
|
|
|
Privileged Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 933 Joined: 24-August 04 Member No.: 892 myCENT:ZERO |
See, im learning now, you forgot the " here: (mysql_error());
I added it: (mysql_error()"); It was not working, 'Im not as think as you confused I am' lol |
|
|
|
Jan 8 2005, 04:03 PM
Post
#12
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 217 Joined: 2-January 05 Member No.: 3,084 |
¿?¿?¿? I did never put this " on mysql_error() function o.O and its not really needed, its only to show the errors (if there are error). Put this function or not, the script must work, because the really needed code is before "or die". But now are your script working well or there is any other problem? I hope I've helped you
|
|
|
|
Jan 8 2005, 04:36 PM
Post
#13
|
|
|
Privileged Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 933 Joined: 24-August 04 Member No.: 892 myCENT:ZERO |
You have helped me loads! I have learned alot from this...
Thank you... I may need you help some time in the near furure... In fact, I have another thread that maybe you can help me with: http://www.trap17.com/forums/trap17-file-no-5379.html |
|
|
|
Jan 13 2005, 06:00 PM
Post
#14
|
|
|
Privileged Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 933 Joined: 24-August 04 Member No.: 892 myCENT:ZERO |
I am using this code for another of my sites, (Toxic Sims), I have added a new field to the table in the database calles 'type'.
How do I display only the ones with a certain entry in that field? So, say I had 10 records, and 7 of them had the word misc in the 'type' field, how will I display only those 7? I hope you get what I mean? |
|
|
|
Jan 23 2005, 02:04 PM
Post
#15
|
|
|
Privileged Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 933 Joined: 24-August 04 Member No.: 892 myCENT:ZERO |
the download page is not working on my sims website...
global vars is turned off, does that effect the download page? here it is, download.php CODE <? $dbhost = 'localhost'; $dbuser = ''; // removed for this $dbpass = ''; // removed for this $dbname = 'toxicsims'; mysql_connect($dbhost,$dbuser,$dbpass); mysql_select_db($dbname); ?> <? if(!$id) return; $query = mysql_query("SELECT * FROM objects WHERE id=$id;"); $download = mysql_fetch_array($query); if(!file_exists($download[location])){ print "File not found."; exit; } mysql_query("UPDATE templates SET clicks=(clicks+1) WHERE id=$id;"); header("Location: $download[location]"); ?> Would anything need to be added, I had some help off my bros m8 to do the insert page. he added the $_POST bits in for me... |
|
|
|
Feb 12 2005, 11:59 PM
Post
#16
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 217 Joined: 2-January 05 Member No.: 3,084 |
QUOTE(cragllo @ Jan 23 2005, 11:04 AM) the download page is not working on my sims website... global vars is turned off, does that effect the download page? here it is, download.php CODE <? $dbhost = 'localhost'; $dbuser = ''; // removed for this $dbpass = ''; // removed for this $dbname = 'toxicsims'; mysql_connect($dbhost,$dbuser,$dbpass); mysql_select_db($dbname); ?> <? if(!$id) return; $query = mysql_query("SELECT * FROM objects WHERE id=$id;"); $download = mysql_fetch_array($query); if(!file_exists($download[location])){ print "File not found."; exit; } mysql_query("UPDATE templates SET clicks=(clicks+1) WHERE id=$id;"); header("Location: $download[location]"); ?> Would anything need to be added, I had some help off my bros m8 to do the insert page. he added the $_POST bits in for me... well man, I think the globals have to be turned on because the page sent an url: download.php?id=1, so, if the globals are turned off it doesn't work. I'll try to found an solution for your problem, and I'll send u another msg if I find it. |
|
|
|
Feb 13 2005, 01:19 AM
Post
#17
|
|
|
Privileged Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 933 Joined: 24-August 04 Member No.: 892 myCENT:ZERO |
Thank you FaLgoR, I may be moving all my sites onto one server soon, to save time and hastle, and so global vars will be turned on then.... Not sure yet tho, may cost too much...
If and when I do, Ill tell you (If you havent already found a solution that is) Craig. |
|
|
|
Feb 13 2005, 02:35 PM
Post
#18
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 378 Joined: 8-January 05 Member No.: 3,174 |
You can do it without the global vars turned on, just instead of having $id in the code you use $_GET['id'].
If you think it's too bulky just have $id = $_GET['id']; somewhere at the top of your code. |
|
|
|
Feb 13 2005, 03:13 PM
Post
#19
|
|
|
.: http://www.xgnews.tk :. ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 119 Joined: 29-October 04 Member No.: 2,025 |
QUOTE(FaLgoR @ Jan 7 2005, 09:06 PM) let's make insert.php (or something else): <?php if($go){ // if var $go is set mysql_query("INSERT INTO table(name,description,image,location) VALUES ('$name','$desc','$image','$location') or die (mysql_error()); echo "Done!"; exit; } else { // not really required at this case but... ?> <form action="insert.php" method="post"> Name: <input type="text" name="name"><br> Description: <input type="text" name="desc"><br> Image: <input type="text" name="image"><br> Location: <input type="text" name="location"><br> <input type="submit" name="go" value="Submit"> </form> <?php } ?> But don't forget to connect this page with the database. I suggest that you make a new page called conection.php with all the details and connections, and put: include("conection.php"); at the top of the pages which requires an connection. My changes are in bold, some of them are not really needed, but this way it's better EDIT: Heh, sorry, thought there was only 1 page ^.^, didn't see the other replys. PS Have you been trying out with this script, is MySQL down because of this xD? |