Sign in to follow this  
Followers 0
Madar

Yet another mysql issue...

3 posts in this topic

Hello again,

I'm trying to rebuild my website to draw data dynamically out of a database (mysql) and I'm at a bit of a roadblock (because I have know idea what %$#@ I'm doing :) ). I'm sure this must be easy enough to do but the logic evades me so I'm hoping someone here can help get me pointed in the right direction. Basically the situation is as follows:

My website http://www.nakedpresident.com has a table grid of cells with each cell holding five pieces of information (call_name, call_text, alt_text, call_photo, and call_audio). I have set up a database that holds the info for each of these cells along with an “id” number for each entry (the five pieces of cell data).

I am off to a pretty good start (or at least it feels that way) in that I am able to extract info from the DB as a group of stings: $call_name, $call_text, etc for the first cell on the page. I can plug these strings into the first cell and they appear to work, hurray! :) The problem (for me) is that I have many cells to fill in and I'm not really sure what the most efficient way would be to get the strings out of the DB for each successive cell. Do I need to make a separate “SELECT FROM” statement for each cell to get the strings that are tied to each successive “id” number? This seems very inefficient to me. Also the individual strings have the exact same names and I'm beginning to think that this might be somehow bad. Anyway, I'm totally lost as to what to do next. If anyone out there has any ideas or could point me to a good example of how something like this should work that would be really fantastic.

Thanks in advance,

Madar

0

Share this post


Link to post
Share on other sites

Try something like this


while (list($call_name, $call_text, $alt_text, $call_photo, $call_audio) = mysql_fetch_row($result)) {
//whatever you want to do with the data here
}

0

Share this post


Link to post
Share on other sites

Hey LogosX,

I found a pretty decent tutorial for building a php/mysql blog here http://www.clearps.com/tjr/computing/building-a-weblog.php and I've been using some code much like what you have purposed. It's slow going but I'm beginning to see real progress. Now I just need to rethink my page layout as the dual column table is proving difficult to populate. I'm thinking to use LIMIT to pull ids 2-8 into one CSS div and make a second call for entries 9-15 to go in a second div (or something like that). This is proving to be a major pain in the butt but hey manually rewriting the page for new content was a bigger pain and offered a major zero in learning factor column :)

Thanks for the assist,

Madar

Try something like this

while (list($call_name, $call_text, $alt_text, $call_photo, $call_audio) = mysql_fetch_row($result)) {
//whatever you want to do with the data here
}

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0