Jump to content

TheHaloEffect

Members
  • Posts

    22
  • Joined

  • Last visited

    Never

Everything posted by TheHaloEffect

  1. Hey! How is Flickr's URL accomplished in the sense of http://www.flickr.com/$username/$randomnumbersgohere/ I've noticed it doesn't have a .php or .html after the final / Any advice would be appreciated! Thanks
  2. Meh, now I've gotta rewrite my whole upload script Yer I meant in a blob.
  3. The image is in MySQL. The path the upload script shows is ?show=xx
  4. http://www.xodiac.net/screens/ does exactly the same thing In theory, it should work...
  5. I tried that before mate, I tried quite a few variations but still no joy. I've changed it now so you can see the error... /home/halo/public_html/screens/phpthumb/screens/upload.php?show=12 does not exist
  6. Hey guys, First off, thanks for looking at my post The problem I'm having is this: I've set phpthumb to do the following:- <img src="phpthumb/phpThumb.php?src=/screens/upload.php?show=<?php $random = rand(11,14); echo $random; ?>" alt=""> Now, on the site itself, it comes up with an error saying Whereas if you visit: http://www.xodiac.net/screens/upload.php?show=12 - the picture does very well indeed exist. Any ideas what's going on? Thanks again! <3
  7. I've renamed the column to brands, and updated the other scripts, and it all works fine, i can submit new brands into the database, and display the contents of the database into another script...but the drop down box still does bugger all Below is the addfood script without the drop down box added to it <html> <head><title>Submit Food</title></head> <body> <?php $self = $_SERVER['PHP_SELF']; $food = $_POST['food']; $amount = $_post['amount']; $energy = $_POST['energy']; $protein = $_POST['protein']; $carbs = $_POST['carbs']; $carbsats = $_POST['carbsats']; $fat = $_POST['fat']; $fatsats = $_POST['fatsats']; $fibre = $_POST['fibre']; $sodium = $_POST['sodium']; $salt = $_POST['salt']; if( ( $food == NULL ) ){ $form ="<h4>Add Food</h4>"; $form.="<form action=\"$self\""; $form.=" method=\"post\">Food name: "; $form.="<input type=\"text\" name=\"food\""; $form.=" value=\"$food\"><br> Amount(g): "; $form.="<input type=\"text\" name=\"amount\""; $form.=" value=\"$amount\"><br> Energy(kcal): "; $form.="<input type=\"text\" name=\"energy\""; $form.=" value=\"$energy\"><br>Protein(g): "; $form.="<input type=\"text\" name=\"protein\""; $form.=" value=\"$protein\"><br>Carbohydrate: "; $form.="<input type=\"text\" name=\"carbs\""; $form.=" value=\"$carbs\"><br> of which sugars: "; $form.="<input type=\"text\" name=\"carbsats\""; $form.=" value=\"$carbsats\"><br> Fat: "; $form.="<input type=\"text\" name=\"fat\""; $form.=" value=\"$fat\"><br> of which saturates: "; $form.="<input type=\"text\" name=\"fatsats\""; $form.=" value=\"$fatsats\"><br> Fibre: "; $form.="<input type=\"text\" name =\"fibre\""; $form.=" value=\"$fibre\"><br> Sodium: "; $form.="<input type=\"text\" name=\"sodium\""; $form.=" value=\"$sodium\"><br> Salt: "; $form.="<input type=\"text\" name=\"salt\""; $form.=" value=\"$salt\"><br><br>"; $form.="<input type=\"submit\" value=\"submit!\">"; $form.="</form>"; echo $form; } else { // MySQL details $mysql_host="localhost"; $mysql_user="test"; $mysql_pass="test"; $mysql_dbname="nutrition_db"; //Connect to MySQL $conn = @mysql_connect( $mysql_host, $mysql_user, $mysql_pass ) or die("Could not connect to MySQL"); //Selects the database $db = @mysql_select_db( $mysql_dbname, $conn ) or die("Could not select database"); //creates the query $sql = "insert into nutrition (food, amount, energy, protein, carbs, carbsats, fat, fatsats, fibre, sodium, salt) values ('".$food."', '".$iron."', '".$energy."', '".$protein."', '".$carbs."', '".$carbsats."', '".$fat."', '".$fatsats."', '".$fibre."', '".$sodium."', '".$salt."')"; $result = @mysql_query( $sql, $conn ) or die("Could not execute query"); if( $result !== FALSE) echo( "$food added" ); } ?> <br> <a href="index.php">Back</a> </body> </html>
  8. On second thought....The box appears...but the brands don't. Any ideas? Thanks
  9. Wow...thanks for the uber speedy responce! The brands don't show in the list though
  10. I've got a database named: nutrition_db I've got a table in there named: brands and inside that I have: brand I've made a script which allows a user to add food to a list, but I'd like a drop down box which has a list of all the brands from my database in, in alphabetical order. I've googled everywhere and searched around on here, but I can't find the solution that suites me. Can anyone help me with this? Thanks!
  11. Thank you for your reply...but all this does is refreshes and makes "Please enter all new user details..." into "Please complete Username and PasswordPlease enter all new user details..." The script that i posted above was 90% copied out of a book...I didn't imagine the book to be wrong =/
  12. I've made a log in script but when I press submit...The script just appears to refresh. Can anyone see what's going on? Thanks <html> <head><title>Register</title></head> <body> <?php $self = $_SERVER['PHP_SELF'];; $username = $_POST['username']; $password = $_POST['password']; if( ( $username == NULL ) or ( $password == NULL ) ) { $form ="Please enter all new user details..."; $form.="<form action=\"$self\""; $form.="method=\"post\">Username: "; $form.="<input type=\"text\" name=\"username\""; $form.=" value=\"$username\"><br>Password: "; $form.="<input type=\"text\" names=\"password\""; $form.=" value=\"$password\"><br>"; $form.="<input type=\"submit\" value=\"Submit!\">"; $form.="</form>"; echo( $form ); }else{ // MySQL details $mysql_host="localhost"; $mysql_user="nikon"; $mysql_pass="lol"; $mysql_dbname="nutrition_db"; //Connect to MySQL $conn = @mysql_connect( "localhost", "nikon", "lol" ) or die("Could not connect to MySQL"); //Selects the database $db = @mysql_select_db( "nutrition_db", $conn ) or die("Could not select database"); //creates the query $sql = "insert into users (username, password) values ('".$username."', '".$password."')"; $result = @mysql_query( $sql, $conn ) or die("Could not execute query"); if( $result !== FALSE) echo( "New user $username added" ); } ?> </body> </html>
  13. I'm trying to make a script that randomly pulls one line out of a text file, replaces the wrod fname with the users input, and then outputs it into the web browser.  I've had loads of trouble with it since i'm not exactly pro with php, but i managed to get there in the end, and i've narrowed it down to one final error...It's displaying everything from a text file instead of just the one line.  The code is attached below, i've tried adding implode and explode, i don't know how that was meant to work, but somebody suggested it on another forum.  Any help please? Pretty desperate now, been bugging me for absolutely ages :( [code]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Fact Generator</title> </head> <body> <div align="center">   <p>&nbsp;  </p>   <p> <?php if(isset($_POST['fname'])) {     $fname = $_POST['fname'];     $filename = "facts.php";     $filedata = file($filename);     shuffle($filedata);     $farray = str_replace(fname, $fname, $filedata[array_rand($filedata)]);     foreach($filedata as $farray) {         echo wordwrap($farray,50,"<br/>");    } } ?>     </p>     </div>   </p> </div> <p align="center">&nbsp;</p>   <p align="center">&nbsp;</p>   <p align="center">&nbsp;</p> <p align="center" class="style4">Enter your name: </p> <p align="center"> <form action="factgen.php" method="post" target="_self" />   <input type="text" size="30" name="fname" value="<?php echo $fname; ?>"/>   </p> <p align="center"> <input type="submit" value="Fact!" /></p> <p align="center">&nbsp;</p> </body> </html>[/code]
  14. I get Parse error: syntax error, unexpected T_STRING in /home/hardware/public_html/random/factgen.php on line 18 with that :(
  15. changed it to [code]    <?php   if (isset($_POST['fname'])){ $fname = $_POST['fname']; $filename = "facts.php"; $filedata = file($filename); shuffle($filedata); $farray = str_replace(fname, $fname, $filedata[array_rand($filedata)]); foreach($farray as $element){ echo wordwrap($filedata, 10,$element); } } ?>[/code] but now i'm getting the error: Warning: Invalid argument supplied for foreach() in /home/hardware/public_html/random/factgen.php on line 19 Any ideas?
  16. [code]    <?php   if (isset($_POST['fname'])){ $fname = $_POST['fname']; $filename = "facts.php"; $filedata = file($filename); shuffle($filedata); echo str_replace(fname, $fname, $filedata[array_rand($filedata)]); } ?>[/code] That's the actual script to pull the data out of a file, and randomly display it. It displays it in an iframe, only the text is partly cut off, so i was hoping to use word wrap to make it smaller, only it takes strings only, not arrays =/
  17. sorry, currently in the library, trying to squeeze everything in heh. What i mean is I've got a file, containing sentance after sentances after sentace. For example:- The quick brown fox jumped over the lazy dog. This old man, he plays 3, He played nick nack on my knee. Izzy wizzy let's get busy. I find your lack of faith disturbing. It's fun to stay at the Y.M.C.A. There's no reason to feel down, I said young man! And I want a word wrap to insert a <br> after every.... 5 words for example I tried using wordwrap() but it says it needs a string and i'm using an array to pull the sentances out of a file. Actually using iframes to display something, but it cuts half of the sentance off, so i'm using the word wrap to shorten it, i hope!
  18. I've got a text file containing thousands of lines of data, which, would take years to insert <br> in the places i need it. I try using Word Wrapping to insert the br every 20 chars or so, but it says that it expects a string not an array.  Is there anything i can use to input the <br>'s in the right places that works with arrays? Thanks
×
×
  • 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.