Jump to content

phpuserlogin

Members
  • Posts

    41
  • Joined

  • Last visited

1 Follower

Contact Methods

  • Website URL
    webwire.great-site.net

Profile Information

  • Gender
    Male

Recent Profile Visitors

666 profile views

phpuserlogin's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. It runs, but when the value is edited, so I removed customer, it then loads sql error. It is just a setup example.
  2. Hi, I was checking out the tutorials, I only noticed this site changed, it now has not just a forum but some sort of portal to login. Been around for sometime now or is it quite new, I think it probably is new. I only found it, when I tried to save example code, and then inquired if I want to login.
  3. Is this certification, like the old Html certificate that was advertised around here eighteen years ago now. I was told it wasn't recognise by any education authority. It was by a former teacher now. I don't know. I haven't worked in IT at all.
  4. It isn't the link, it is the drop down menu. https://www.w3schools.com/css/css_dropdowns.asp I was thinking of the old drop downs before Html 5.😐
  5. <?php # Set page title and display header section. $page_title = 'database' ; include ( 'includes/header.html' ) ; # Open database connection. require ( 'connect_db.php' ) ; # Display body section, retrieving from 'forum' database table. $q = "SELECT * FROM forum" ; $r = mysqli_query( $dbc, $q ) ; if ( mysqli_num_rows( $r ) > 0 ) { echo '<table>'; while ( $row = mysqli_fetch_array( $r, MYSQLI_ASSOC )) { echo ' <td>' . $row['subject'] . '</td> </tr>'; } echo '</table>' ; } else { echo '<p>There are currently no messages.</p>' ; } # Close database connection. mysqli_close( $dbc ) ; # Display footer section. include ( 'includes/footer.html' ) ; ?> I've updated it, so it just displays the words in the subject row from the sql. So Playstation 2 model no would be selected from the actual subject row, via link, and a drop down menu would be the select method. I've solved the display of the data. How do I create a link to select subject row or what ever.
  6. <?php # Set page title and display header section. $page_title = 'database' ; include ( 'includes/header.html' ) ; # Open database connection. require ( 'connect_db.php' ) ; # Display body section, retrieving from 'forum' database table. $q = "SELECT * FROM forum" ; $r = mysqli_query( $dbc, $q ) ; if ( mysqli_num_rows( $r ) > 0 ) { echo '<table><tr><th>Posted By</th><th>Subject</th>'; while ( $row = mysqli_fetch_array( $r, MYSQLI_ASSOC )) { echo '<tr><td> <td>' . $row['subject'] . '</td><td>' . '</td> </tr>'; } echo '</table>' ; } else { echo '<p>There are currently no messages.</p>' ; } # Close database connection. mysqli_close( $dbc ) ; # Display footer section. include ( 'includes/footer.html' ) ; ?>
  7. $q = "SELECT * FROM forum" ; $r = mysqli_query( $dbc, $q ) ; if ( mysqli_num_rows( $r ) > 0 ) { echo '<table><tr><th>Posted By</th><th>Subject</th><th id="msg">Message</th></tr>'; while ( $row = mysqli_fetch_array( $r, MYSQLI_ASSOC )) { echo '<tr><td>' . $row['first_name'] .' '. $row['last_name'] . '<br>'. $row['post_date'].'</td> <td>' . $row['subject'] . '</td><td>' . $row['message'] . '</td> </tr>'; } echo '</table>' ; } So row Posted by, do I make a link in order to select that column, or use a drop down. to select a specific row for the data. Posted by is just an example. Record data 1, a very basic example is just what I'm trying to tinker with, with this code. Subject and so on.
  8. <?php # Set page title and display header section. $page_title = 'database' ; include ( 'includes/header.html' ) ; # Open database connection. require ( 'connect_db.php' ) ; $q = "SELECT * FROM forum" ; $r = mysqli_query( $dbc, $q ) ; if ( mysqli_num_rows( $r ) > 0 ) { echo '<table><tr><th>Posted By</th><th>Subject</th><th id="msg">Message</th></tr>'; while ( $row = mysqli_fetch_array( $r, MYSQLI_ASSOC )) { echo '<tr><td>' . $row['first_name'] .' '. $row['last_name'] . '<br>'. $row['post_date'].'</td> <td>' . $row['subject'] . '</td><td>' . $row['message'] . '</td> </tr>'; } echo '</table>' ; } else { echo '<p>There are currently no messages.</p>' ; } # Close database connection. mysqli_close( $dbc ) ; # Display footer section. include ( 'includes/footer.html' ) ; ?> I would like to select one row list of the following. As this old example displays a bunch of rows, so a drop down menu would individual select one item from the sql. Can I do that with this example, is it complicated to do so?
  9. It was unfortunate, it was useless in the end.
  10. There are no errors registered with the code? F12 didn't give me any shown.
  11. The tutorial starts out by displaying this code. <!DOCTYPE html> <html> <div style='background-color:gold; width:640px;'> <canvas id="gameCanvas" width="640" height="480"></canvas> </div> <div style='display:none;'> <img id='dog' src='smuffy.png'> <img id='donut' src='donut.png'> </div> <script> </script> </html> I forgot html at the top there, but that doesn't change the result. Then the next code part is this. var ctx=gameCanvas.getContext("2d"); var x=[100,300,500]; var y=[0,0,0]; var speed=[2,1,3]; var dogX=300, changeX=0, score=0; var gameTimer=setInterval(mainloop,20); function mainloop() { ctx.clearRect(0,0,640,480); ctx.font="30px Arial"; ctx.fillText("Score: "+score,10,30); for(var n=0; n<3; n++){ ctx.drawImage(donut,x[n],y[n],50,50); y[n]+=speed[n]; checkForHits(); if(y[n]>400){ y[n]=-80; x[n]=Math.random()*600; } } ctx.drawImage(dog,dogX,400,60,60); dogX+=changeX; } </script> </htm> Exactly as shown in the book, so you just remove or add the exact code and don't include the two tags below a section on arrays to do with the objects, essentially what the code does. Then it says to check F12 for any bugs. Gives an example of the word snuffy as smffy, but obviously there is no error of that sort. Then the next page, move the player code, document.onkeydown=keyPressed; function keyPressed(e){ var k=e.keyCode; if(k==37){changeX=-4;} if(k==39){changeX=4;} } Then the next part below is check for Hits. function checkForHits(n) { if((Math.abs(400-y[n])<60)&& (Math.abs(dogX-x[n])<60)){ score+=1; y[n]=-80; x[n]=Math.random()*600; } } I didn't include the sound file, I don't think that would matter. bleep.play above the first curly The the last is Gameover setTimeout(gameover,30000); function gameover(){ clearInterval(gameTimer); ctx.font="80px Arial"; ctx.fillText("Game Over!",100,250); } You know better than I do, the game sort of works, but the check hits section doesn't register a touch with the object and player.
  12. Correct, now this is from a tutorial, from a book. So it works partially, but for what ever reason the player can't catch the object, it doesn't detect. Why is that?
  13. If added with this code, what happens? setTimeout(gameover,30000); function gameover(){ clearInterval(gameTimer); ctx.font="80px Arial"; ctx.fillText("Game Over!",100,250); } </script> </html>
  14. <!DOCTYPE html> <div style='background-color:gold; width:640px;'> <canvas id="gameCanvas" width="640" height="480"></canvas> </div> <div style='display:none;'> <img id='dog' src='smuffy.png'> <img id='donut' src='donut.png'> </div> <script> var ctx=gameCanvas.getContext("2d"); var x=[100,300,500]; var y=[0,0,0]; var speed=[2,1,3]; var dogX=300, changeX=0, score=0; var gameTimer=setInterval(mainloop,20); function mainloop() { ctx.clearRect(0,0,640,480); ctx.font="30px Arial"; ctx.fillText("Score: "+score,10,30); for(var n=0; n<3; n++){ ctx.drawImage(donut,x[n],y[n],50,50); y[n]+=speed[n]; checkForHits(); if(y[n]>400){ y[n]=-80; x[n]=Math.random()*600; } } ctx.drawImage(dog,dogX,400,60,60); dogX+=changeX; } document.onkeydown=keyPressed; function keyPressed(e){ var k=e.keyCode; if(k==37){changeX=-4;} if(k==39){changeX=4;} } Does this code work? function checkForHits(n) { if((Math.abs(400-y[n])<60)&& (Math.abs(dogX-x[n])<60)){ score+=1; y[n]=-80; x[n]=Math.random()*600; } } </script> </html> Thanks
  15. Hello, I tried this code in a game, but doesn't do anything. if(score>highScore){ localStorage.setItem('highScore',score); var highScore=0, loc=localStorage.getItem('highScore'); if(loc>0)highScore=loc; The bottom would be added after var variables. And the top is for the Game over part of the game. ctx.fillText("High Score: "+HighScore,400,20); } This would go in a Function Check for Hits, at the very end
×
×
  • Create New...