Jump to content

wildteen88

Staff Alumni
  • Posts

    10,480
  • Joined

  • Last visited

    Never

Everything posted by wildteen88

  1. Try this for view.php: <html> <head> <title>View Flash</title> </head> <body> <?php require("dbconnect.php"); //add slashes to flashid (passed via view.php?id=$id) $id = addslashes($id); //selects database row with passed flashid $query = "select * from flash where flashid = $id"; $result = mysql_query($query); $row = mysql_fetch_array($result); //declare variables $views = stripslashes($row['views']); $score = stripslashes($row['score']); $score = $score.' / 10'; $title = stripslashes($row['title']); $author = stripslashes($row['author']); $email = stripslashes($row['email']); $website = stripslashes($row['website']); $height = stripslashes($row['height']); $width = stripslashes($row['width']); $description = stripslashes($row['description']); $userfile = stripslashes($row['userfile']); $date = stripslashes($row['date']); $category = stripslashes($row['category']); $flashid = stripslashes($row['flashid']); ?> <font size="4"><strong>Movie Stats</strong></font><br> <strong>Title: </strong>$title<br> <strong>Author: </strong>$author<br> <a href="mailto:<?php echo $email;?>">Email</a> | <a href="<?php echo $website; ?>" target="_blank">Website</a><br> <strong>Category: </strong><?php echo $category; ?><br><strong>Date Added: </strong><?php echo $date; ?><br> <strong>Views: </strong><?php echo $views; ?><br><strong>Score: </strong><?php echo $score; ?><br> <form name="form1" method="post" action="rate.php?id=<?php echo $flashid; ?>"><div align="center"> <select name="rate" id="rate"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> </select> <input type="submit" name="Submit" value="Rate"> <p><font size="4"><strong><?php echo $title; ?></strong></font></p> <div align="left"><strong><font style="text-decoration=underline">Author's Discription:</font></strong><br> <?php echo $description; ?> <br><a href="javascript:void(0)" onClick="window.open('<?php echo $userfile; ?>','miniwin','toolbar=0,location=0,directories=0, status=1,menubar=0,scrollbars=0,resizable=0,width=<?php echo $width; ?>, height=<?php echo $height; ?>')"> <?php //checks if submission is a movie or a game if ($category == 'Game/Interactive') { echo "Play Game"; } else { echo "Play Movie"; } echo "</a>"; //Read/Write reviews link (opens reviews window) $query = "select * from flash_reviews where flashid = $id"; $result = mysql_query($query); $numreviews = mysql_num_rows($result); echo("<a href=\"javascript:void(0)\" onClick=\"window.open('review.php?id=$id','miniwin ','toolbar=0,location=0,directories=0,status=1,men ubar=0,scrollbars=0,resizable=0,width=470, height=510')\">Write/Read Reviews("); //prints number of reviews already written echo ($numreviews); echo (")</a>"); $views++; $viewquery = "update flash set views = '".$views."' where flashid = $id"; $viewresult = mysql_query($viewquery); ?> </body> </html> Re-coded some parts of it.
  2. What version of Apache are you using? Make sure you are using the correct PHP module for the version of Apache you have installed. Eg, for Apache2.0.x you use php5apache2.dll, for Apache2.2.x you use php5apache2_2.dll. Also try removing the php.ini from C:/php5, just incase it could be PHP's configuration that could be screwing up the startup process for Apache. EDIT: Just noticed these lines: Include "c:/wamp/apache2/conf/alias/phpmyadmin.conf" Include "c:/wamp/apache2/conf/alias/sqlitemanager.conf" Include "c:/wamp/apache2/conf/alias/v.conf" Do you have WAMP from wampserver.com installed? If you do why are you adding PHP to Apaches configuration? WAMP is a preconfigured package.
  3. Use an email client instead prehaps. I prefer to read my emails via thunderbird. Can't see how firefox suddenly loads pages slowly?
  4. Post me the output of this: while($row = mysql_fetch_array($res, MYSQL_ASSOC)) { echo '<pre>' . print_r($row, true) . '</pre>'; }
  5. Whats the filed that contains the time? You place Thorpes snippet in the SELECT statment, eg: SELECT *, DATE_FORMAT(fld,"%h:%i") AS formattedtime FROM WHERE datum >= CURDATE( ) AND iedereen = 1 ORDER BY datum'; change the highlighted text in red to the column which contains the time. Then use $row['formattedtime'] to get the formatted time
  6. Give your navigation links a class name instead. That way you can style them separately from your page links.
  7. Ok lets continue. Where does stdntid1, stdntid2, stdntid3 etc come into it? Or is stdntid supposed to be clsid?
  8. OMG! Everyone please read my post here. I know you can use foreach to loop through $row, but you can't usit it loop through simiar variables. That is how d22552000 was using foreach earlier. d22552000 hold on a sec.
  9. Why wouldn't you be able to do this? o_O <?php foreach($row as $r) { echo $r.'<br />'; } ?> No no, misunderstood me there, before they was passing $row['stdntid1'] and not $row in the foreach, thinking it will loop through $row['stdntid1'], $row['stdntid2'] $row['stdntid3'] etc when using $row['stdntid1']. Thats what i meant by : foreach can only be used if the variable you pass it contains an array. foreach wont loop through similar variables.
  10. How is $row formatted? Run print_r on $row in your while loop to see how $row is formatted.
  11. taking quick look at view.php you have syntax errors, mainly the echo statements. You have them formatted incorrectly. Change this block: echo("<font size="4"><strong>Movie Stats</strong></font><br>"); echo ("<strong>Title: </strong>$title<br>"); echo ("<strong>Author: </strong>$author<br>"); echo ("<a href='mailto:$email'>Email</a> | <a href='$website' target='_blank'>Website</a><br>"); echo ("<strong>Category: </strong>$category<br>"); echo ("<strong>Date Added: </strong>$date<br>"); echo ("<strong>Views: </strong>$views<br>"); echo ("<strong>Score: </strong>$score<br>"); //make rate form so user can rate submission (we will create the rate.php file later) echo("<form name='form1' method='post' action='rate.php?id=");"); echo($flashid); echo("'><div align='center'> <select name='rate' id='rate'> <option value='1'>1</option> <option value='2'>2</option> <option value='3'>3</option> <option value='4'>4</option> <option value='5'>5</option> <option value='6'>6</option> <option value='7'>7</option> <option value='8'>8</option> <option value='9'>9</option> <option value='10'>10</option> </select> <input type='submit' name='Submit' value='Rate'>"); echo("<p><font size="4"><strong>$title</strong></font></p>"); echo("<div align='left'><strong><font style='text-decoration=underline'>Author's Discription:</font></strong><br>"); echo ($description); //echo link that opens movie in new non-resizeable window echo("<br> <a href="javascript:void(0)\" onClick=\"window.open('"); echo ($userfile); echo ("','miniwin','toolbar=0,location=0,directories=0, status=1,menubar=0,scrollbars=0,resizable=0,"); echo ("width="); echo ($width); echo (", height="); echo ($height); echo ("')\">"); To: echo <<<EOF <font size="4"><strong>Movie Stats</strong></font><br> <strong>Title: </strong>$title<br><strong>Author: </strong>$author<br> <a href='mailto:$email'>Email</a> | <a href='$website' target='_blank'>Website</a><br> <strong>Category: </strong>$category<br><strong>Date Added: </strong>$date<br> <strong>Views: </strong>$views<br><strong>Score: </strong>$score<br> <form name='form1' method='post' action='rate.php?id=$flashid'> <div align='center'> <select name='rate' id='rate'> <option value='1'>1</option> <option value='2'>2</option> <option value='3'>3</option> <option value='4'>4</option> <option value='5'>5</option> <option value='6'>6</option> <option value='7'>7</option> <option value='8'>8</option> <option value='9'>9</option> <option value='10'>10</option> </select> <input type='submit' name='Submit' value='Rate'> <p><font size="4"><strong>$title</strong></font></p> <div align='left'><strong><font style='text-decoration=underline'>Author's Discription:</font></strong><br> $description <br><a href="javascript:void(0)" onClick=\"window.open('$userfile','miniwin','toolbar=0,location=0,directories=0, status=1,menubar=0,scrollbars=0,resizable=0,width=$width, height=$height')\">" EOF;
  12. its got to be outputing something! If the following doesn't output any thing: while($row = mysql_fetch_array($res, MYSQL_ASSOC)) { echo 'row contents: ' . print_r($row); } Then the above block of code is not be ran, due to an error or a logic error in your code.
  13. Post more info about your problem. Posting "Something is wrong with this not sure what ..." is not going to yield you any helpful replies.
  14. The css above will only apply to anchor tags (<a href="#"></a> only, and not very element within #maincontent.
  15. AddType application/x-httpd-phps .phps When you request a file with a .phps extensions php will highlight and display the source code for that file.
  16. foreach can only be used if the variable you pass it contains an array. foreach wont loop through similar variables. what you'll want to do is count how many items $row contains, substract the total items by 1 then using a for loop echo out $row['stdntidX'] example: // get total items in the $row array $items = count($row) - 1; // now that we not how many items are in the $row array, // we can use a for loop to loop through the array for($i = 1; $i <= $items; $i++) { echo $row['stdntid' . $i] . '<br />'; }
  17. Chnage your code to this: foreach($tagArray as $array => $val) { $zscoreInt = round($val['count'] - $stdev); $tagArra[$array]['fontsize'] = $avgFontsize + $zscoreInt . 'px'; } When using $val, this is a new instance, when ever you update this variable it wont affect the array. What you'll have to do is refer to the array instead.
  18. That error is to do with your mysql query and not your PHP code. character is a reserved word, meaning you cannot use it for table/columns names. What you'll want to do is change and instance of character to `character` (basically place backticks around that word) when using that word in your queries.
  19. Change $_GET['lang'] to $_POST['lang'] instead for d22552000's code
  20. personally I always use underscores in replacement of spaces, However the conversion does take place automatically by the browser when the form is submitted.
  21. Ooh, shoot! Hold on. the name attribute can't have spaces. You should use underscores (_) in replacement. Then use $_POST['first_name'] to get the value for that field. Sorry about my last post, thinking about the wrong thing
  22. How have you coded your form? Make sure you wrap quotes around the name attribute for the input tag, eg don't so this: <input type=text name=first name> MAke sure you do this: <input type="text" name="first name"> if you don't use quotes around values for attributes your browser will ignore the spaces and use treat each individual word as an attribute and not a value.
  23. You have to modify the code in the FAQ to your code. You cannot use the code unmodified. EDIT try the following: <table cellspacing="3" cellpadding="3"> <?php $con = mysql_connect("localhost","username","password") or die('Could not connect: ' . mysql_error()); mysql_select_db("caffein_product", $con); $query = "SELECT * FROM details ORDER BY id"; $result = mysql_query($query) or die("There was a problem with the SQL query: " . mysql_error()); if($result && mysql_num_rows($result) > 0) { $i = 0; $max_columns = 6; while($row = mysql_fetch_array($result)) { // make the variables easy to deal with extract($row); // open row if counter is zero if($i == 0) echo "<tr>"; echo '<td>' . $row['name'] . '<br />'; echo '<img src="' . $row['image'] . '" width="100" height="100"><br />'; echo "Description: " . nl2br($row['description']) . '<br />'; echo 'Price: ' . $row['price'] . '<br />'; echo $row['paypal']. '</td>'; // increment counter - if counter = max columns, reset counter and close row if(++$i == $max_columns) { echo "</tr>"; $i=0; } // end if } // end while } // end if results // clean up table - makes your code valid! if($i < $max_columns) { for($j=$i; $j<$max_columns;$j++) echo "<td> </td>"; } mysql_close($con); ?> </tr> </table>
  24. Am I mistaken but aren't 192.168.2.x address for internal networks only? If you want someone to access you from the internet (outside of your network) you will want user your computers IP address and not your networks ip.
  25. When you setup the $_SESSION['box'] array, you are not setting up a multi dimension array. Instead you are setting up a 2d array. Only until the else block gets executed $_SESSION['box'] becomes a multidimensional array. Eg: Whn you first run that code and $_SESSION['box'] is not set. It'll create following array: Array ( [0] => username_here [1] => password_here [2] => id_here ) When that block of code is executed again, the else part will execute as $_SESSION['box'] now exists. However when it is executed the array will turn into this: Array ( [0] => username_here [1] => password_here [2] => id_here [3] => Array ( [0] => username_here [1] => password_here [2] => id_here ) ) $_SESSION['box'] becomes an multidimensional array at index 3. This is the problem. To fix it you'll need to do this: Change this line: $_SESSION['box'] = $CartItem; To: $_SESSION['box'][] = $CartItem; However you will need to unset the first 3 keys in order for your code to work. Or you could just fix the first 3 keys for the box session. with this: if(!is_array($_SESSION['box'][0])) { $_SESSION['box'][0] = array($_SESSION['box'][0], $_SESSION['box'][1], $_SESSION['box'][2]); unset($_SESSION['box'][1], $_SESSION['box'][2]); } You can remove the above three lines once you have run the code. This will just fix the session format.
×
×
  • 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.