Jump to content

odisey

Members
  • Posts

    66
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Male
  • Location
    Morgantown, WV - Just south of Canada

odisey's Achievements

Member

Member (2/5)

0

Reputation

  1. Thanks guys. This is an excellent forum! I have the array() lesson. You guys should LOCK that upTop. Odisey
  2. mbeals I got it! with this: if ($result) { $i=1; while ($row = mysql_fetch_array ($result, MYSQL_NUM)) { $varname = "vars$i"; //will create a variable name: var1, var2, var3.... $i++; $$varname = $row[0]; } //echo "$vars1 $vars2 $vars3"; } echo '<p>'. $vars1 . '</p>'; echo '<p>'. $vars2 . '</p>'; echo '<p>'. $vars3 . '</p>'; I am interested in what Crayon Violet thinks about passing these variables to flash as file names for swf movies to load. Does this make sense -- will it work? TY for your help guys, I am getting there. Odisey
  3. In response to Crayon violet: This is excellent. It is just over my head at this time. Trying to learn here. I had had a LIMIT 3 in an earlier version. And decided it was not needed until I had defined the unique variables. Here is what I want to do with the data. You said you are not sure why I want unique variables when they contain the same information. This is one of my disconnects with learning Php. It seems if you can create an array with many variables, you should be able to deconstruct it as well and then use each. I am missing this...I just can't wrap the brain around it. I want to stay within a mental framework that is comprehensible to me.... Otherwise I might get something that works, I won't know why it works though. I want to send three randomly chosen variables to flash. Of course these are derived of the images column in the db. There are eight images total. These will be swf file names once I get this code figured out. As you can imagine I want to load those randomly choosen file (swfs) in Flash once they are passed. I am much better on Php that AS. Arrays make me crazy. How to make them, use them for drop downs, etc... np. I just want to access the array in Php and create unique varialbes ($vars1, $vars2, $vars3...etc...)...so I can see it with my own two eyeballs. This way the how why what where may finally enter my brainstem and take up residence. If I can do this GREAT! I am reading the AS Bible and I have a Joey Lott course I am taking. More complicated AS will come soon. TY I will save this code. Is it possable to create these unique variables in Php? What concepts about arrays am I completely missing here? TY Odisey OK: Let me try to rework mbeals version TY. I though the double $$ was a typo. Almost there.
  4. No I cannot get it. More help needed. What have I right and wrong here?
  5. I am getting closer, I can feel it. Here is what I am testing, and it is not working. Once I see the syntax in proper fashion, I will understand the logic. BE RIGHT BACK <?php #Color instrument vars # ODC August 4, 2008 require_once ('????.php'); //Connect to database RESET TO SAFE PATH ONCE IT FUNCTIONS // Define variables $var1 = "Hello"; // Make selection $query = "SELECT images FROM movie_images ORDER BY RAND()"; $result = mysql_query($query) or die(mysql_error()); // Table if ($result) { $i=1; while ($row = mysql_fetch_array ($result, MYSQL_NUM)) { $varname = "vars$i"; //will create a variable name: var1, var2, var3.....varn $i++; $varname = $row[0]; ####### ##or use an array if you can $vars[] = $row[0]; } echo '<p>'. $var1 . '</p>'; //echo '<p>'. $result . '</p>'; //echo '<p>'. $s3 . '</p>'; echo '<p>'. $vars2 . '</p>'; } else { echo 'There was a problem...'; } mysql_close(); // Close database connection ?>
  6. Yeah, this is what has eluded me. I think this is the answer. I will try this out and get back in a few minutes. TY! Odisey
  7. I read your post, and I really am not sure what the problem is by what you have said. You do not what something selected duplicated? Can you be more specific? I will try. Odisey
  8. Hello freaks! I am trying to do something that seems so simple, yet a day later I resort to your expertise. I am selecting all rows in a column in a MySQL db. There are 8 records. I want to sort them ramdomly and pluck the top three. I don't just want to loop and print the results, I want to redefine each as a unique variable to pass to Flash. The code I have here will print the results. How do I reassign the results to unique variables? Thank you for your help. Odisey <?php #Color instrument vars # ODC August 4, 2008 require_once ('???????????.php'); //Connect to database RESET TO SAFE PATH ONCE IT FUNCTIONS // Define variables $var1 = "Hello"; // Make selection $query = "SELECT images FROM movie_images ORDER BY RAND()"; $result = mysql_query($query) or die(mysql_error()); // Table if ($result) { while ($row = mysql_fetch_array ($result, MYSQL_NUM)) { $s1 = $row[0]; // $s2 = $row[1]; // $s3 = $row[2]; echo '<p>'. $s1 . '</p>'; //echo '<p>'. $result . '</p>'; //echo '<p>'. $s3 . '</p>'; echo '<p>'. $var1 . '</p>'; } } else { echo 'There was a problem...'; } mysql_close(); // Close database connection ?>
  9. Can you explain in a little more detail what you mean? Do you mean results returned from a query to a MySQL db using php? I think you are using php because you are in the php forum. This is a php specific problem - if you are talking about the front end. In this case you have to code a function that dynamically writes the html code, adding your returned results to a list of hyperlinks. The hymperlinks again would point to a page which provided the more comprehensive information you want to display. Unless someone else chimes in with a predefined function php may have that displays infomation (such as the php info function - which displays version and settings), I think you will have to actually code it. Marc
  10. I've narrowed it down to the SELECT statement dot syntax. Why would dot syntax execute in the WHERE statement and not the SELECT statement? This will not execute: $query = "SELECT student_score.description_id, student.last_name WHERE student_score.mid_final = 'M' AND student_score.student_id = 700900127 AND student_score.year = 2006 AND student.student_id = 700900127"; This will $query = "SELECT description_id FROM student_score WHERE student_score.mid_final = 'M' AND student_score.student_id = 700900127 AND student_score.year = 2006"; Marc
  11. I had tried that - and again after your post... Nothing prints...?
  12. I am trying this simple snippet to get a print to build from -- I get nothing... Any ideas why? $query = "SELECT student.last_name, characteristics.char_desc WHERE student_score.mid_final = 'M' AND student_score.student_id = '700900127' AND student_score.year = '2006'"; /* , SUM (student_score.score) as total FROM student_score INNER JOIN question ON student_score.q_id = question.q_id INNER JOIN area ON question.area_id = area.area_id INNER JOIN characteristics ON area.char_id = characteristics.char_id INNER JOIN student ON student_score.student_id = student.student_id GROUP BY student.last_name, characteristics.char_desc"; */ $result = @mysql_query($query); if ($result) { echo 'result'; while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { /* echo '<p align="left">' . $row['total'] . '</p>'; // ' . $row['char_desc']'</p>'; echo '<br /><br />'; */ echo "<pre>"; print_r($row); echo "</pre>"; } } Thank you for all your help, Marc
  13. Actually Barand helped me construct the tables and joins...expert. I have the site built now...And I am adding the last page...the print results pages(s). Thank you, Marc
  14. Id is possable to get an example of the query and output?
  15. I am not sure if this is the right forum: My question is about running a db parse query. Using PhpMyAdmin I would run something like: SELECT student.studentname, characteristics.char_desc, SUM(student_score.score) as total FROM student_score INNER JOIN question ON student_score.q_id = question.q_id INNER JOIN area ON question.area_id = area.area_id INNER JOIN characteristics ON area.char_id = characteristics.char_id INNER JOIN student ON student_score.student_id = student.student_id WHERE student_score.mid_final = 'M' AND student_score.student_id = '7001234' AND student_score.year = '2006' GROUP BY student.studentname, characteristics.char_desc Notice I have accessed columns in two tables, student and characteristics. Is it possable to run such a query in Php to parse a MySQL db? Something like $query = "SELECT column FROM table1 AND column FROM table2, SUM SUM (student_score.score) as total FROM student_score INNER JOIN question ON student_score.q_id = question.q_id INNER JOIN area ON question.area_id = area.area_id INNER JOIN characteristics ON area.char_id = characteristics.char_id INNER JOIN student ON student_score.student_id = student.student_id WHERE student_score.mid_final = 'M' AND student_score.student_id = '7001234' AND student_score.year = '2006' GROUP BY student.studentname, characteristics.char_desc"; $result = @mysql_query($query); if ($result) { while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { PRINT HERE
×
×
  • 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.