Jump to content

monkey64

New Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

monkey64's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks for the quick reply. It worked fine. Would this be faster to execute than my original version?
  2. I'm a newbie and I'm trying to simplify my code. Instead of: echo "var is "; if ($var < 0) echo "negative"; else echo "positive"; I'm using this: echo "var is ".($var < 0 ? "negative" : "positive"); But, in this example, I want to simplify it in the same manner. if($finance > '2000') { $loan = $finance - 2000; $deposit = $loan; } else { $loan = $finance; $deposit = $finance / 10; // 10% of Discount Price } Thing is, in each condition, I have two variables. Can it be simplified?
  3. "not always helpful, but always trying" Actually the code was VERY helpful. I now have a working example. Just couldn't get my head around it. Thanks again.
  4. I do know that I can't use PHP with the onchange event as it's a Server Side language, not Client side like Javascript. I used the onchange event to describe what I want to do. Here we go! I have two drop-down boxes on my form which are populated dynamically from my database. Here's what I want to: 1. Pre-populate the first drop-down box from the database. 2. Make a selection. 3. When the onchange event occurs, populate the second drop-down box with a query based on the value from first one. There's a good example here: http://www.eurocarparts.com If you select a manufacturer, and click the button, the next drop-down gives you values only relevant to that manufacturer. It's really smart. Is it even possible using PHP? Any help would be appreciated
  5. Hi there I have some code which runs perfectly well in HTML, but falls over in PHP. I know I've got the wrong syntax. This is the code as from the HTML page. <td class="menuoff" onmouseover="className='menuon';" onmouseout="className='menuoff';"></td> I want to insert it in my PHP page, but I can't get the syntax right: <?php // Make a MySQL Connection $host="localhost"; $user="realbab_mark"; $password="xxxx"; mysql_connect($host,$user,$password); mysql_select_db("realbab_phpbb") or die(mysql_error()); // Get all the data from the table $result = mysql_query("SELECT * FROM phpbb_posts_text") or die(mysql_error()); echo "<table width='200' cellspacing='1' cellpadding='3'>"; // keeps getting the next row until there are no more to get while($row = mysql_fetch_array( $result )) { // Print out the contents of each row into a table echo "<tr>[!--coloro:#FF0000--][span style=\"color:#FF0000\"][!--/coloro--]<td class="menuoff" onmouseover="className='menuon';" onmouseout="className='menuoff';">[!--colorc--][/span][!--/colorc--] echo $row['post_subject']; echo "</td><td>"; } echo "</table>"; ?> Can anyone help?
  6. I’d better make it clear that I’m really new to MySQL and PHP programming. I have a good working knowledge of HTML and CSS, but these two are tough languages! All I want to do is display the contents of a field in a given database table in an HTML page. I’d like to show these contents either in an HTML table, or the text area element of an HTML form. So far, I’ve created the following code which executes correctly from my .php page and displays the data as I wanted. However, I’m mystified as to how to embed this data into a table, grid, or text area element of an HTML form. [!--coloro:#FF0000--][span style=\"color:#FF0000\"][!--/coloro--]<?php // Make a MySQL Connection mysql_connect("localhost", "realbab_mark", "coco") or die(mysql_error()); mysql_select_db("realbab_phpbb1") or die(mysql_error()); // Retrieve all the data from the "example" table $result = mysql_query("SELECT * FROM phpbb_posts_text") or die(mysql_error()); while($row = mysql_fetch_array($result)){ echo $row['post_subject']; echo "<br />"; } ?> [!--colorc--][/span][!--/colorc--] Can anyone help me before my head explodes!
×
×
  • 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.