Jump to content

nashsaint

Members
  • Posts

    84
  • Joined

  • Last visited

    Never

Everything posted by nashsaint

  1. Hi, Below is my sql query. I have a table that will output the count result of the query. I wanted to do same query for the other 11 months changing the WHERE clause but then i think that would be too heavy for sql to handle. Is there a more optimized way of doing this? say, function maybe? or an array? I don't have any idea how to code it. Any help is greatly appreciated.
  2. Hi, I followed the instruction here to create a drop-down and populate from sql and works great. . What i have are 3 dropdown menus all populated from 3 different sql tables/fields (city, age, sex) and the script only shows how to do it using 1 dropdown menu. what i have in mind is that when the user selects an entry from the 2nd dropdown, ajax will display the result filtering the result of the 1st dropdown AND the 2nd dropdown... then eventually the third. As you can see i am a newbie to this, even explaining it.. any help is greatly appreciated. thanks.
  3. Thanks a lot Maq. That is exactly what I wanted. Thanks.
  4. sorry about that... what i want is to check data in sql on the fly, without refreshing or redirecting a php page.
  5. Hi, I have a site running locally, using php and sql. I've seen some pretty sites online with what they call spry or ajax. I am a newbie to this kind of script so i don't know where to begin, especially because I needed to do it quickly. My site, like i said, is running perfectly. All i want to do is introduce ajax or spry into it. Is there a way to kind of wrap my sql queries or php script with ajax? or i have to rewrite my script altogether to achieve this? I've done some research already on google and found a couple of ways but I am just hoping you gurus out there can help me solve this quickly. Thanks in Advance! More power!
  6. That works well. Have one more problem though, how can i sort the result by count? I tried this code but didn't work, produced same problem.
  7. This is the query: This is the form that populates the query:
  8. Hi, I have a simple query to count names of their occurence and then sort by count. Here's the query. The query works perfectly if i run it inside phpmyAdmin but produced this error when running the actual php page: Thanks in advance.
  9. Hi, i used this code: but for some reason sql added it using this format (y.m.d).
  10. thanks, like i said ive done then and found YUI calendar which looks cool but my being a newbie with php fails me to identify which variable catches the value when user selects a date. i guess ill have to keep looking. thanks Blade280891.
  11. yeah, that's the first thing i done before posting a thread here. but no luck.
  12. can anyone recommend a calendar script to use that can use the value to query sql? i am a newbie on php. I found a YUI calendar but didn't find a way to catch the user's selection and use it to query sql. thanks.
  13. has any used this script? How do i get the value of user's selection? i tried reading the documentation but didn't find the solution. I just want to get the value and pass it to a variable for use with sql queries later. thanks.
  14. Hi, I searched the forum for solution to my problem but there seems to be no reply to all queries. I am posting this topic again hoping to get lucky. This is my code: My intention is to generate xml file from this query for use with fusionchart. Help is greatly appreciated. thanks.
  15. Hi, am using dreamweaver to generate the code. I manually added a variable which handles username session: Now i wanted to insert the value to sql into same table field name "uid". Below is the code dreamweaver populated to insert data to sql. any help is much appreciated. thanks.
  16. Hi, Does anyone knows what the session id DW CS4 is using by default? I want to know the session id for sql query to match with other field using Where Clause. I tried using but there was an error. please help. thanks.
  17. Thanks MatthewJ, you've given me the idea. I added "LIMIT $start, $display" to the query and it works like a dream. Thanks again.
  18. the pagination is controlled by the last code and display is limited by the variable "$display = 10; " This exact set of codes work for other queries but this.
  19. Hi, I created a code that will display records of the day, with pagination. The problem is that the result displays all the records in 1 page, though I set the display limit to 10, but pagination displays more pagenumbers and shows same entries when numberings are clicked. Here's my code for the count: $display = 10; $curday = date("Y-m-d"); $query = "SELECT count(*) FROM job_log WHERE date_added ='$curday' ORDER BY eng_name"; $result = @mysql_query ($query); $row = mysql_fetch_array ($result, MYSQL_NUM); $num_records = $row[0]; // Calculate the number of pages. if ($num_records > $display) { // More than 1 page. $num_pages = ceil ($num_records/$display); } elseif ($row[0] == 0) { echo ' <center>There are currently no entries</center> '; include ('../../includes/footerSingle.html'); exit(); } else { $num_pages = 1; } Here's my code to query and display records: // Make the query. $fcurd = date("Y-m-d"); $query = "SELECT date_added, eng_name, job_no, diagnosis FROM job_log WHERE date_added ='$curday' ORDER BY eng_name"; $result = @mysql_query ($query); // Run the query. // Table header. echo '<div id="display_livejobs"></div>'; echo '<table align="center" class="tableQueryList"> <tr> <th class="head" align="center"><b>No.</b></th> <th class="head" align="center"><b>Name</b></th> <th class="head" align="left"><b>Job Number</b></th> <th class="head" align="left"><b>Diagnostic</b></th> </tr> '; $count = 0; while ($drow = mysql_fetch_array($result, MYSQL_ASSOC)) { switch (true) { default: $bg = '#ffffff'; } echo ' <tr bgcolor="' . $bg . '"> <td align="center">'. $count ++ .'</td> <td align="left">' . $drow['eng_name'] . '</td> <td align="left">' . $drow['job_no'] . '</td> <td align="left">' . $drow['diagnosis'] . '</td>'; } echo '</table>'; and here's the pagination: if ($num_pages > 1) { echo '<br /><p>'; // Determine what page the script is on. $current_page = ($start/$display) + 1; // If it's not the first page, make a Previous button. if ($current_page != 1) { echo '<a href="index.php?s=' . ($start - $display) . '&np=' . $num_pages . '&sort=' . $sort .'">Previous</a> '; } // Make all the numbered pages. for ($i = 1; $i <= $num_pages; $i++) { if ($i != $current_page) { echo '<a href="index.php?s=' . (($display * ($i - 1))) . '&np=' . $num_pages . '&sort=' . $sort .'">' . $i . '</a> '; } else { echo $i . ' '; } } // If it's not the last page, make a Next button. if ($current_page != $num_pages) { echo '<a href="index.php?s=' . ($start + $display) . '&np=' . $num_pages . '&sort=' . $sort .'">Next</a>'; } echo '</p>'; } // End of links section. Hope you can help.. many thanks.
  20. it's an honest mistake... forgot to say "please" and sarcasm starts... thanks anyway..
  21. Hi, I want a script to empty all the entries of the table everyday. Thanks a lot.
  22. Hi, This is xurion's code which i got somewhere in this forum. I just want to format the cell of the .csv output file, like cell width, font size.. etc... Please help. Here's the code. <?php require_once ('./mysql_connect.php'); // Connect to the db. //head information for a csv file header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: private",false); Header("content-type: text/html"); header("Content-Disposition: attachment; filename=\"tcdisks.csv\";"); header("Content-Transfer-Encoding: binary"); //echo the first line to be the titles of the columns (notice the return at the end of the line) echo '"Job Number","Model Number","Firmware" '; //query the db for the information $result = mysql_query("SELECT * FROM disks ORDER BY job_no"); //echo each record (notice the return at the end of the line) while ($row = mysql_fetch_array($result)){ echo '"'.$row['job_no'].'","'.$row['model_no'].'","'.$row['firmware'].'" '; } ?>
  23. Hi, I used Xurion's method and it works great. I have one question though, I want the .csv file to be preformatted to specific cell width. how can I do that using php code? thanks.
  24. This is my code: $sql = "SELECT * FROM job_log_pull"; $res = mysql_query($sql); if(mysql_num_rows($res) > 0){ echo("<select name=\"make\">"); while($row = mysql_fetch_object($res)){ echo("<option value=\"$row->make_id\">$row->pc</option>"); } echo("</select>"); } else { echo("<i>No values found.</i>"); }
×
×
  • 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.