Jump to content

Immortal55

Members
  • Posts

    59
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Immortal55's Achievements

Member

Member (2/5)

0

Reputation

  1. Well, that gave me more errors, now I have this one: [b] Warning: Wrong parameter count for mysql_query() in /home/theblizz/public_html/whitedevil/calendertest.php on line 14 SELECT DAY(event_date) AS day, COUNT(event_id) FROM calender_events WHERE MONTH(event_date) = 01 AND YEAR(event_date) = 2007 GROUP BY day Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/theblizz/public_html/whitedevil/calendertest.php on line 16[/b]
  2. Ah, thank you for that. That got me over one hurdle, but now I am getting an SQL error: [b]You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '(event_date) AS day, COUNT(event_id) FROM calender_events WHERE[/b] What in the world should I change there, as far as I know that should be perfect...
  3. This is the error that I keep getting.... [b]Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/theblizz/public_html/whitedevil/calendertest.php on line 13[/b] I do not understand, I even copied the code from the page and pasted it and it still is giving me this error! Here is the code (I know I spelled calendar wrong, but that is how it is.): PHP code: [code=php:0] function getEventDays($month, $year) {   $days = array();   $sql = mysql_query("SELECT DAY(event_date) AS day, COUNT(event_id) FROM calender_events WHERE MONTH(event_date) = " . $month . " AND YEAR(event_date) = " . $year . " GROUP BY day");   if (mysql_num_rows($sql) > 0) {   while ($row = mysql_fetch_array($sql)) $days[] = $row['day'];   }   return $days;     } [/code] One last thing the $_GET where exactly is it getting the year and month from??? Thank you in advance. Also, this is all pertaining to the ([url=http://www.phpfreaks.com/tutorial_cat/29/Calendars--Date-&-Time.php]http://www.phpfreaks.com/tutorial_cat/29/Calendars--Date-&-Time.php[/url]) calendar tutorial here on the PHP freaks website.
  4. What I want this script to do is take values from my database and assign them to the numerous variables that the array creates, so if the script worked it would output this: &Name0=[b]NAME[/b]&TextData0=[b]TEXT[/b]&Author0=[b]AUTHOR[/b]&TheDate0=[b]DATE[/b]&Name1=[b]NAME[/b]&TextData1=[b]TEXT[/b]&Author1=[b]AUTHOR[/b]&TheDate1=[b]DATE[/b]&Name2=[b]NAME[/b]&TextData2=[b]TEXT[/b]&Author2=[b]AUTHOR[/b]&TheDate2=[b]DATE[/b]&NumItems=3&Go=Yes& I just bolded the values to show you that I want them to say something. All I am getting as output right now is this: &Name0=&TextData0=&Author0=&TheDate0=&Name1=&TextData1=&Author1=&TheDate1=&Name2=&TextData2=&Author2=&TheDate2=&NumItems=3&Go=Yes& See, no values. My DB has 3 records in it, so the final NumItems is correct, but why is nothing else getting any values?
  5. I do not get exactly what you are trying to say, but when I put $i in the while loop it messes everything up. With the $i before the first while loop, I get the correct increments and everything, something is just wrong with my array, that is all.
  6. I am sorry, but I believe doing that would just reset $i to 0, which is not what I want at all.... I have a new problem though... It is with my array, the array is not getting my results. Here is the script: [code] $i=0; while ($tablefield = mysql_fetch_assoc($result) && $numm = mysql_num_rows($result)) {         $id[$i] = $row['id'];         $title[$i] = $row['title'];         $author[$i] = $row['author'];         $thedate[$i] = $row['date'];         $text[$i] = $row['story']; $numReturn = $numm; while ($i < $numReturn) {         $Name        = $title[$i];         $TextData    = $text[$i];         $Author      = $author[$i];         $TheDate      = $thedate[$i];         print "&";         print "Name$i=$Name&TextData$i=$TextData&Author$i=$Author&TheDate$i=$TheDate";         $i++;     }} [/code] everything is working fine, except nothing has any values from the database, which makes me think that the array is not working for some reason....Thanks for the help...
  7. I have this script here, and it is grabbing the information from my database table, and assigning them to values. The problem is my value is set to 3 for every value.... Here is the script: [code] if ($result) {     $i = 0;     while ($tablefield = mysql_fetch_array($result, MYSQL_ASSOC)) {         $id = $tablefield['id'];         $Name = $tablefield['title'];         $Author = $tablefield['author'];         $TheDate = $tablefield['date'];         $TextData = $tablefield['story']; $numReturn = count($tablefield); while ($i < $numReturn) {         $Name        = $Name;         $TextData    = $TextData;         $Author      = $Author;         $TheDate      = $TheDate;         print "&";         print "Name$i=$Name&TextData$i=$TextData&Author$i=$Author&TheDate$i=$TheDate";         $i++; }     }     $numItems = mysql_num_rows($result);     print "&NumItems=$numReturn&Go=Yes&"; } [/code] this exports this: [b]&Name3=Test1&TextData3=Hello, this is a story that hopefully will be called into flash!&Author3=Mitch&TheDate3=today&Name3=Test2&TextData3=Well, this is coming from the future......Yeah.&Author3=John&TheDate3=tomorrow&Name3=Test8000&TextData3=ZUBBLE CUBBLE MUBBLE SHUBBLE&Author3=Toby&TheDate3=June 5th, 3030&NumItems=3[/b] Notice how all the actual number values are set to 3, which I have 3 inputs in the database, so it is counting right, but it's assigning it to every one.... I want the variables going up incrementally (i.e. Name1=Test1 .... Name2=Test2...) What is the problem. Thank you in Advance.
  8. According to the last post (which is still the current state of my script) It shows only one set of information from the table, the most recently added one to say. What could the problem be? This is really tough! Thanks in advance again.
  9. I altered the code a little bit.....but now it only shows the most recently added entry in the database, but only once. here it is: [code] if ($result) { while ($tablefield = mysql_fetch_array($result, MYSQL_ASSOC)) { $id = $tablefield['id']; $title = $tablefield['title']; $author = $tablefield['author']; $thedate = $tablefield['date']; $text = $tablefield['story']; } $numReturn = count($tablefield); $i = 0;     while ($i < $numReturn) {         $Name        = $title;         $TextData    = $text; $Author   = $author; $TheDate      = $thedate; print "&";         print "Name$i=$Name&TextData$i=$TextData&Author$i=$Author&TheDate$i=$TheDate";         $i++;     }print "&NumItems=$numReturn&Go=Yes&"; } [/code] Help appreciated! Thank you!
  10. Alright, I am doing a little dynamic loading in flash, and I am trying to load the variables from a PHP script. I make an array based on the entries in the table, and then they are passed on to flash....The only thing is is that my script grabs the same story multiple times.....and sometimes in a nonsense order.... Here is the script: [code] mysql_connect('localhost','admin','iffy') or die ('Could not connect to database'); mysql_select_db('whitedevil') or die ('Yeah, your database was found, but not the tables!'); $result = mysql_query('SELECT * FROM news') or die ('no query'); if ($result) { while ($tablefield = mysql_fetch_array($result, MYSQL_ASSOC)) { $id = $tablefield['id']; $title = $tablefield['title']; $author = $tablefield['author']; $date = $tablefield['date']; $text = $tablefield['story']; $numReturn = count($tablefield); $i = 0; print "&";     while ($i < $numReturn) {         $Name        = $title;         $TextData    = $text; $Author   = $author; $TheDate      = $date;         print "Name$i=$Name&TextData$i=$TextData&Author$i=$Author&TheDate$i=TheDate&";         $i++;     } print "&NumItems=$numReturn&Go=Yes&"; }} else { print('Sorry, no work.'); } [/code] now what would be doing that?? Thank you in advance!
  11. Alright, lets say I have a LONGTEXT field in my DB, and something long is entered in there. And on a page i only want to show......lets say 25 characters, how would I limit it to only showing 25 characters?
  12. Well, thank you, you cleared up a lot of questions I had even thought I did'nt ask. The explanation of the while loop helped a lot too, thank you.
  13. Alright, well what i am trying to do is, I have a database and in the database it stores some info on an image, blah blah. and What I am trying to do is be able to call the images from the database. but when i do it, the same image comes up for all the images that are called from a catagory... here is the script: [code=php:0] <?           require_once('dbconnect.php');           $conn = db_connect();           $db = @mysql_select_db ("theblizz_mitchanderson", $conn)               or die ("Registration failure, try again.");         $sql = mysql_query("SELECT * FROM photos WHERE catagory = '{$_REQUEST['catagory']}' ORDER BY id DESC") or die(mysql_error()); while($row = mysql_fetch_array($sql))     {     stripslashes($row); $path = $row['path']; $id = $row['id']; $image = $path; if(!$max_width) $max_width = 150; if(!$max_height) $max_height = 150; $size = GetImageSize($image); $width = $size[0]; $height = $size[1]; $x_ratio = $max_width / $width; $y_ratio = $max_height / $height; if( ($width <= $max_width) && ($height <= $max_height) ) { $tn_width = $width; $tn_height = $height; } else if (($x_ratio * $height) < $max_height) { $tn_height = ceil($x_ratio * $height); $tn_width = $max_width; } else { $tn_width = ceil($y_ratio * $width); $tn_height = $max_height; }} $sql = mysql_query("SELECT * FROM photos WHERE catagory = '{$_REQUEST['catagory']}' ORDER BY id DESC") or die(mysql_error()); while($row = mysql_fetch_array($sql))     {     stripslashes($row); echo '<a href="deletepic.php?id=' . $id . '">'; echo '<img src="' . $path . '" width="' . $tn_width . '" height="' . $tn_height . '" border="1">'; echo '</a><br>'; } ?> [/code] So pretty much, its just calling the same image x amount of times, i know its the same image because its the same id number, and the actual same image... Thanks in advance.
×
×
  • 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.