• Some users have recently had their accounts hijacked. It seems that the now defunct EVGA forums might have compromised your password there and seems many are using the same PW here. We would suggest you UPDATE YOUR PASSWORD and TURN ON 2FA for your account here to further secure it. None of the compromised accounts had 2FA turned on.
    Once you have enabled 2FA, your account will be updated soon to show a badge, letting other members know that you use 2FA to protect your account. This should be beneficial for everyone that uses FSFT.

question about php with mysql

Joined
Feb 22, 2009
Messages
928
Hi Guys
I just wanted to know if this even possible to do? here what I am looking to do can I use php with tables and use mysql to fill in the tables or not.

I got a picture what I am looking to do:
fjj5va.jpg
 
Last edited:
Yes, put your correspnding variables into the table cell you want and once you get your table columns filled then loop the table or rows so that it fills the output table with the rows you want from the DB. This can be a set number of rows or all of the entries found.

It is easy to do and there are lots of tutorials (google) that show you how to set it up. Sorry its been a while since I have done it, so I don't remember the code to do it.
 
maybe somebody can help me on getting the correct code for the drop down option for php/mysql and also wondering about mysql statement for this drop down option whats the statement for that?
 
PHP generates HTML that the browser renders. There are countless ways to accomplish this, unless you want someone to write it for you (in which case you will probably need to pay them...), you will need to learn the fundamentals.
 
well I am writing this code by myself with help with guides that I am googling all I was asking for was getting the correct drop down option code (yes I know there is many different ways on doing it but I was just asking for the most easiest wayt of doing it)and the correct mysql statement for this drop down option. I mean keenan you didn't have to be a complete a$$ on reply if you ask me your reply was just right down rude.
 
You've given us basically no information at all about what you're trying to accomplish. A screenshot tells us nothing. I don't even know what drop down you're talking about...I don't see one in your screenshot or described in your posts. In HTML, a typical dropdown looks like:
Code:
<select id="selecty">
  <option>One</option>
  <option>Two</option>
  <option selected="1">Three</option>
</select>

Unless your options are changing, I wouldn't generate it from MySQL, store it directly in your PHP source (or via an include) instead. Or store an array with a list of options and do something like:
Code:
<select id="selecty">
  <?php foreach ($options as $o) { echo '<option>' . $o . '</option>'; } ?>
</select>

I don't mean to be rude, but your question is extremely vague.
 
well sorry for not posting up a screenshot I just didn't want to create a new subject while I got one already open like this one because this code that I am trying to write this code is going for what the screenshot is showing. Thanks keenan for posting the correct drop down option code. Also the options isn't going to be changing after this code is done and written.

pretty much I am going to use php with tables but use mysql to fill in the table with information.
 
you can also create a table on your SQL DB for drop downs and use PHP to query the table to populate the DB. This works well for large items that are used multiple times or for form input to help mitigate user error. Something like the State drop down, or a drop down for departments, or maybe technician's names. Things like might change would benefit from this approach as well, since all you would have to do is update the table behind the scenes.
 
well i have a other question is this correct for mysql statement $selecty=$_POST['selecty']; for the drop down option?
 
Yeah that should be right if you use POST. But that's not MySQL, that's PHP.
 
Uck that page shows some terrible code.

MySQL is a database engine you can connect to from your PHP program (or many other languages), they're completely separate things. The actually query itself (and the database design that you do, but that's totally independent of the PHP code anyway in most cases) is the only part of that example that is 'MySQL', the rest is all PHP.
 
Back
Top