Jump to content

dreamwest

Members
  • Posts

    1,223
  • Joined

  • Last visited

    Never

Everything posted by dreamwest

  1. Sort the list in PHP _before_ assigning it to smarty variable. Zend encrypted they are
  2. HEY it works! Thanks for your help i couldn't have done it without you
  3. yes thats it. But i still need to insert the id, it needs to count up from 1
  4. 5 the final column is "download": This is used by another script, its only values can be 0 or 1. But for the import the value can be 0 for all rows and the first column is the id eg; 1,2,3,4 etc... Heres the TABLE create script i used: mysql_query("CREATE TABLE gallery_import( id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(id), categories TEXT, category_url TEXT, description TEXT, download TINYINT NOT NULL)") or die(mysql_error());
  5. Sorry the error i was getting was: Column count doesn't match value count at row 1 INSERT INTO import VALUES
  6. Your right must have overlooked it. I ran the script but im getting an error: Column count doesn't match value count at row 1 INSERT INTO gallery_import VALUES Any idea whats going on??
  7. Yes taht would work but i know nothing about javascript, i know php,mysql and html. I cant use php because im using smarty templates, but the template will accept javascript programming Can someone give me an example of how this would work..Thanks
  8. I tried this bjut it didnt work: <?php mysql_connect("localhost", "user", "pass") or die(mysql_error()); mysql_select_db("name") or die(mysql_error()); echo "connected"; $lines = file('file.txt'); foreach($lines as $line) { $e = explode('|', $line); $e[0] = mysql_real_escape_string($e[0]); $e[1] = mysql_real_escape_string($e[1]); $e[2] = mysql_real_escape_string($e[1]); mysql_query("INSERT INTO VALUES ('$e[0]', '$e[1]'), '$e[2]') ;"); } echo "done"; ?> I created a file called "file.txt" and uploaded it to the same directory. The contents of file.txt look like this: category_name1|category_url1|description1 category_name2|category_url2|description2 category_name3|category_url3|description3 etc.... And the columns of the table are: categories, category_url, and description Can anyone see my errror??
  9. Is there a way to order a list by name?? Bannana Orange Apple Mango Once ordered by name it will be: Apple Bannana Mango Orange
  10. Is there a way to order a list by name using html only?? Bannana Orange Apple Mango Once ordered by name it will be: Apple Bannana Mango Orange
  11. Ive been told this is a php question..... I have 20,000 lines of string seperated by a deliminator "|" in a .txt file like this: Description is here| Category is here| Title is here Description2 is here| Category2 is here| Title2 is here Is there a way to split the string up into sections before inserting them into the databse?? The database columns are "description" "category" and "title"
  12. I have a list of about 20,000 descriptions and categories like this: Description is here|Category is here How can i use this to INSERT values into 2 separate columns named "category" and "description"
  13. Thorpe can you post a link to this syntax, i want to add a ucfirst to the command mysql_connect("localhost", "user", "pass") or die(mysql_error()); mysql_select_db("dbname") or die(mysql_error()); $sql = "UPDATE video SET title = REPLACE(SUBSTRING_INDEX(full_video_name, '.', 1), '-', ' ');"; mysql_query($sql) or die(mysql_error()); Thanks
  14. what you should do now is comment out the code that i gave u if it works, and try make thorpes way work Did it thorpes way to begin with Thanks for your help anyways
  15. Hey not bad!! Works well Thanks
  16. Still not seeing it....how can i integrate this into the above script?? Like this??: $result = mysql_query("SELECT * FROM video") or die(mysql_error()); while($row = mysql_fetch_array( $result )){ mysql_query("UPDATE video SET title= REPLACE(SUBSTRING_INDEX(full_video_name, '.', 1), '-', ' '), ' WHERE VID='".$row['id']."'") or die(mysql_error()); }
  17. Heres a tricky one, im trying to strreplace while executing a mysql command, not sure how i should go about it... mysql_connect("localhost", "user", "pass") or die(mysql_error()); mysql_select_db("dbname") or die(mysql_error()); $result = mysql_query("SELECT * FROM video") or die(mysql_error()); while($row = mysql_fetch_array( $result )){ mysql_query("UPDATE video SET title='".$row['full_video_name'].", ' WHERE VID='".$row['id']."'") or die(mysql_error()); } Basically this script transfers the column "full_video_name" to column "title". Full video name is something like: i-like-crosscountry.wmv I need to strip the '-' and extension using: <?php $theFile = 'I-like-crosscountry.wmv'; $theFile = str_replace("I like crosscountry.wmv","I like crosscountry",$theFile); echo $theFile; //outputs I like crosscountry ?> So how does one execute a strreplace with this query?
  18. I want to update values everytime a script runs Example: $result = mysql_query("UPDATE video SET viewnumber='2' WHERE viewnumber='0'") or die(mysql_error()); Im trying to increase the number by 2 everytime the script runs. But i cant see how i can do this when WHERE viewnumber='0' can be any number
  19. Only problem is they only let me execute once a day
  20. How can i strip an extension from a string?? I like crosscountry.wmv To be just: I like crosscountry
  21. Is there a simple way to execute a php page with php code. I have a page called cron.php and i need to run it every 1 minuet Is there a way i can execute this page using a php script
  22. Easier to make 2 separate requests, and store them in different variables
  23. Ok back to the ward now chris... But seriously Australians still have guns they just have to go though a lengthy time period befroe they can get it, i think its 8-12 weeks. Thats how all countries should be, you shouldn't be able to buy guns at a supermarket and stash them where they are easily assessable for venting anger. I love Americans but you live like theres a world war going on right now...why do you buy a gun?? Answer: To kill ppl
×
×
  • 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.