berry05
Members-
Posts
204 -
Joined
-
Last visited
Never
Everything posted by berry05
-
sorry i've been gone ---promise not to ask much questions xD
berry05 posted a topic in Introductions
sorry I've been gone for awhile ....no i haven't been on other php forum sites!!! I've just been caught up doing other things...you people that now me might be like o god here comes the questions again, but no, i am here to not ask questions but to learn and look for answers before i ask xD Well anyways besides that... I am back again because this site is obviously #1 !! xD -
I'm sorry but i wanted to post this in the PHP section, no AJAX is included...if someone could move this thread that would be great!
-
I have check boxes next to each item when I call up the items from mySQL . How do i make the item disappear in the mySQL database when i user ticks the box and clicks "sell item"? I've been having trouble on that .. <html> <body> <p><a href="index2.php">Index</a> | <a href="shop.php">Shop</a> | <a href="sell.php">Sell</a> | <a href="logout.php">Logout</a> </p> </p> <?php session_start(); $checked = $_POST['checked']; if(isset($_SESSION['otherusername'])){ $db=mysql_connect('localhost', 'root', ''); $res=mysql_select_db('txtgame',$db) or die(mysql_error()); $otherusername = $_SESSION['otherusername']; //"SELECT item FROM users_items WHERE username='".$Username."'"; $res=mysql_query($otherusername)or die(mysql_error()); while($row = mysql_fetch_assoc($res)){ echo ' <input type="checkbox" name="item[]" value="items" />'. ' '.$row['item']."<BR />"; } }else{ echo "Sorry your not a member please join us!"; } ?> <br><input type="submit" value="sellitem"> </form> </body> </html> Thanks !
-
[SOLVED] how to add a checkbox after a field that has been called
berry05 replied to berry05's topic in PHP Coding Help
fixed by the help of vishal !! thxs man ! -
how do i add a check box to a field that has been called onto the browser...i want to have a check box after each item that has been called but I've been looking around and cannot find anything on it ... Here's the code... <html> <body> <p><a href="index2.php">Index</a> | <a href="shop.php">Shop</a> | <a href="sell.php">Sell</a> | <a href="logout.php">Logout</a> </p> </p> <?php session_start(); if(isset($_SESSION['otherusername'])){ $db=mysql_connect('localhost', 'root', ''); $res=mysql_select_db('txtgame',$db) or die(mysql_error()); $otherusername = $_SESSION['otherusername']; //"SELECT item FROM users_items WHERE username='".$Username."'"; $res=mysql_query($otherusername)or die(mysql_error()); while($row = mysql_fetch_assoc($res)){ echo ' '.$row['item']."<BR />"; } }else{ echo "Sorry your not a member please join us!"; } ?> <br><input type="submit" value="sellitem"> </form> </body> </html> Thanks !
-
LOL I need to learn PHP waaay better than what I know now..aha
-
im learning! aha i figured it out by using arrays! now i dont need to use the database.. here's the simple code.. <?php $problems = array ( "1+1=", "1+2=", "1+3=" ); $random = $problems[array_rand($problems)]; echo $random; ?>
-
now i get this array(1) { ["problems"]=> string(4) "1+1=" }
-
how do i make something happen when a checkbox is ticked
berry05 replied to berry05's topic in PHP Coding Help
now it shows the two checkbox's but doesn't show the items name next to it >_> -
I have 3 math problems in my table...I want to show a random math problem when i run the script...just 1 out of the 3... btw thanks for helping me out man!
-
how do i make something happen when a checkbox is ticked
berry05 replied to berry05's topic in PHP Coding Help
lol...sry if i didnt explain this good enough..ok..so there's a query that shows the fields of a table and shows all the items that user thats logged in has...once it showed up there's a checkbox to each item..if a user wants to sell that item he checks it off and clicks sell....once he clicks sell it echoes saying you've sold "whatever item"! and then i can take care of the rest like updating the database to the users gold and stuff..i can do that part.... -
mhm when i do that it now just says.. Array ... wouldn't i need to change this part then? while($row = mysql_fetch_array( $result )) {
-
how do i make something happen when a checkbox is ticked
berry05 replied to berry05's topic in PHP Coding Help
prints this out sess - SELECT item FROM users_items WHERE username='berry05'Sorry you're not a member. Please join us! -
i get this error "Resource id #3 " when i run the script... <?php // Make a MySQL Connection mysql_connect("localhost", "root", "") or die(mysql_error()); mysql_select_db("math") or die(mysql_error()); // Get all the data from the "example" table $result = mysql_query("SELECT * FROM problems ORDER BY RAND() LIMIT 0,1;") or die(mysql_error()); // 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 $result; } ?>
-
how do i make something happen when a checkbox is ticked
berry05 replied to berry05's topic in PHP Coding Help
<?php session_start(); if (isset($_SESSION['otherusername']) && !empty($_POST['submit'])) { $sell = 'hoe'; $db=mysql_connect('localhost', 'root', ''); $res=mysql_select_db('textgame',$db) or die(mysql_error()); $otherusername = $_SESSION['otherusername']; $res = mysql_query($otherusername) or die(mysql_error()); while($row = mysql_fetch_assoc($res)){ $item = $row['item']; echo $item, '<input type="checkbox" name="checkbox[]" id="checkbox"', ($row['item'] === $sell? ' selected="selected"' : ''), '><br />'; echo "Hoe Sold"; } } else { echo 'Sorry you\'re not a member. Please join us!'; } ?> <form id="form1" name="form1" method="post"> <label> <br /> Sell: <input type="submit" name="Sell" id="Sell" value="Sell" /> </label> <label> <input type="submit" name="submit" value="submit" /> </label> </form> -
how do i make something happen when a checkbox is ticked
berry05 replied to berry05's topic in PHP Coding Help
i tried to add a echo and i got Sorry you're not a member. Please join us! when i tried to sell the item... -
how do i make something happen when a checkbox is ticked
berry05 replied to berry05's topic in PHP Coding Help
I'm almost there! How do I make a if statement that if the item is a hoe and it is selected and the user clicks submit it says Hoe Sold! Thanks! -
how do i make something happen when a checkbox is ticked
berry05 replied to berry05's topic in PHP Coding Help
yes and there's nothing wrong with that part..that part is fine -
how do i make something happen when a checkbox is ticked
berry05 replied to berry05's topic in PHP Coding Help
Thanks for the reply! Still trying to work on it..i added what you told me to add and still nothing..my code now looks like this <?php session_start(); if(isset($_SESSION['otherusername'])) { $db=mysql_connect('localhost', 'root', ''); $res=mysql_select_db('textgame',$db) or die(mysql_error()); $otherusername = $_SESSION['otherusername']; $res=mysql_query($otherusername)or die(mysql_error()); while($row = mysql_fetch_assoc($res)){ echo $row['item'] ."<input type='checkbox' name='checkbox' id='checkbox'><BR />" ; if(isset($_POST['checkbox'])) { if ( $row['item'] == 'hoe' ) { echo "Your name is someguy!<br />"; } } } }else{ echo "Sorry your not a member please join us!"; } ?> -
Hello, I was wondering how do I make something happen when a check box is ticked and then they click submit... when i load the page it shows the items that can be selled and then it also echoes what i want it to echo but it does it without hitting submit...i just load the page and it does it...I'm kind of confused and need help on this.. thanks! here's my whole sell.php code!! <?php session_start(); if(isset($_SESSION['otherusername'])){ $db=mysql_connect('localhost', 'root', ''); $res=mysql_select_db('textgame',$db) or die(mysql_error()); $otherusername = $_SESSION['otherusername']; $res=mysql_query($otherusername)or die(mysql_error()); while($row = mysql_fetch_assoc($res)){ echo $row['item'] ."<input type='checkbox' name='checkbox[]' id='checkbox'><BR />" ; $item_array[0] = "hoe"; if ( $item_array[0] == 'hoe' ) { echo "Your name is someguy!<br />"; } } }else{ echo "Sorry your not a member please join us!"; } ?> <form id="form1" name="form1" method="post" action=""> <label> <br /> <input type="submit" name="Sell" id="Sell" value="Sell" /> </label> </form>
-
[SOLVED] when i check a checkbox another one checks
berry05 replied to berry05's topic in PHP Coding Help
lol there was a piece of HTML code interfering with it... thanks all!