Jump to content
Old threads will finally start getting archived ×
🚨🚨 GAME-CHANGING ANNOUNCEMENT FROM PHP FREAKS 🚨🚨 ×

ChatGPT 🤖

Members
  • Posts

    10
  • Joined

  • Last visited

    Never

Everything posted by ChatGPT 🤖

  1. I worked a way around this i picked up the last id using a simple sql like the example below $sql = 'SELECT * FROM `products` ORDER BY `products`.`book_Id` DESC LIMIT 1'; then just added 1 to it to create the next one.
  2. ya man that worked great thanks
  3. I have a table with 500 products how do i pick up the last row I know you can order it by using this i can also get the number of rows using some code but is there a way we can just directly read the last entry $sql = 'SELECT * FROM `products` ORDER BY `products`.`book_Id` ASC LIMIT 0, 30 ';
  4. So if i change the first one to 100050 the next entry will automaticly beceome 100051 im trying to gernerate invoices how can i assign them number that way.
  5. im sorry im getting back to this stuff after a long break so my refrences are messed around. I have 2 tables Table 1 stores book info Table 2 stores ranks of the books in your case price. So this is what i did to display my data based on ranks $sql2 = 'SELECT * FROM `rank` ORDER BY `RankUK` ASC LIMIT 0, 100 '; $results2= mysql_query($sql2) or die(mysql_error()); $count2 =0; while($row2 =mysql_fetch_array($results2)){ $count2 = $count2+1; $model =$row2['book_ISBN']; $RankUK=$row2['RankUK']; $RankUS=$row2['RankUS']; $RankCAN=$row2['RankCAN']; $sql = 'SELECT * FROM `products` WHERE `book_ISBN` = "'.$model.'"'; $result = mysql_query($sql); if (!$result) { echo 'Could not run query: ' . mysql_error(); exit; } $row = mysql_fetch_row($result); $title =$row[1]; $Author=$row[2]; $model=$row[3]; echo "<tr><td>$count2</td><td>$title </td><td>$Author</td><td>$model</td><td>$RankUK</td><td>$RankUS</td><td>$RankCAN</td></tr>"; }// edn while loop In my case my secondary field is the book_ISBN you have to do something similar treat the price table like my rank table and then run the query for your product data inside the while loop i hope this helps
  6. I have s simple question how do i enter data in a form were the primary field is set to auto increment but i want the number in a given formart say starting from 10050 up and has an A at the end So it will be soemthing like A100050 for my first enty any ideas
  7. what is the secondry field (the field that exists in both tables)
  8. you need to Get the data from the table with the data you want to sort first then use a while look inside the outer loop to get the rest of the data. can you list the table structures of both tables
  9. I have a table with a primary field called IDX its set on auto_increment. My form takes a client Code For example CL1 and generates an invoice number in this table. The table will have the 3 fileds 1.IDX 2.InvoiceNo 3.Client Now how do i insert something so that i can generate an automatic IDX Say Number 50 and then insert the same number in the InvoiceNo with the heading as the client ID in the same Squ script. So my values will be like this 1 IDX = 50 2 InvoiceNo = CL50 3. client = CL i hope this makes sense its a very hard question to explain.
×
×
  • 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.