PHP - Incrementing Form Names
IronMineList.php:
Code: [Select] <?php include('buildingfile.php'); ?> <?php $dbhost = 'localhost:3306'; $dbuser = 'root'; $dbpass = 'root'; $dbname = 'aosdb'; $conn = mysql_connect($dbhost,$dbuser,$dbpass) or die ('Error connecting to mysql'); mysql_select_db($dbname); $query="SELECT * FROM IMPrints"; $result=mysql_query($query); $num=mysql_num_rows($result); $i=0; $n=1; $j=0; $b=1; while($i<$num) { $name = mysql_result($result, $i, 'name'); $work = mysql_result($result, $i, 'workers'); $effi = mysql_result($result, $i, 'efficiency'); $cost = mysql_result($result, $i, 'cost'); $iron = mysql_result($result, $i, 'iron'); $copp = mysql_result($result, $i, 'copper'); $silv = mysql_result($result, $i, 'silver'); $titan = mysql_result($result, $i, 'titanium'); $gold = mysql_result($result, $i, 'gold'); $uran = mysql_result($result, $i, 'uranium'); $plat = mysql_result($result, $i, 'platinum'); $diam = mysql_result($result, $i, 'diamonds'); $oil = mysql_result($result, $i, 'oil'); $water = mysql_result($result, $i, 'water'); include('Iron.php'); $i++; $b++; $j++; $n++; } ?> Iron.php: Code: [Select] <?php $dbhost = 'localhost:3306'; $dbuser = 'root'; $dbpass = 'root'; $dbname = 'aosdb'; $conn = mysql_connect($dbhost,$dbuser,$dbpass) or die ('Error connecting to mysql'); mysql_select_db($dbname); $queryj = "SELECT name FROM IMPrints"; $resultj = mysql_query($queryj); $Column = mysql_result($resultj, $j); $queryp = "SELECT * FROM IMBuilt WHERE idcol = $idcol"; $resultp = mysql_query($queryp); $Base = mysql_fetch_row($resultp); if(isset($_POST[""])) { if($_POST[""]) { $Badd = $Base[$b]+$_POST[""]; $queryi="UPDATE IMBuilt SET $Column=$Badd WHERE idcol = $idcol"; mysql_query($queryi); } } $queryf = "SELECT * FROM IMBuilt WHERE idcol = $idcol"; $resultf = mysql_query($queryf); $Basic = mysql_fetch_row($resultf); echo $i; ?> <p class="bd" id="built">| Built: <?php echo $Basic[$n]; ?> |</p> <form class="bd" method="post" action="IronMineList.php"><input type="text" name='[]'><input type="submit" value="Build"></form> What those 2 php documents do is display a list of iron mines a player in my game can build. It is supposed to create 1 form for each blueprint so that a player can add only to the number of that blueprint on their colony. The displays work perfectly. It creates 1 div that properly displays the stats of each mine in the database table. It also creates one form for each div. The problem I have is, I can only make the forms add 1 to all the buildings on a colony. The name='' value of the form and the $_POST[''] values do not increment with the rest of the code. I need a way to make each form apply only to the div which displays a specific mine. So where $i=0 the first form should only alter the value in imbuilt for the stats that are displayed by the rest of the div created for $i=0. Similar TutorialsI'm building a website in which the user can upload 3 photos of the same product (from different angles). what i want is that the user only selects those 3 iamges, writes a description and when they press upload the system creates an album named "1" with the 3 images in it. the next time the new folder name will be "2" I tried storing them on a mysql database but i read it makes it too heavy and the queries take longer. so i'll just save the path there. thanks! Ok so I am writing a CMS to wrap around a company script I wrote a while back. I am having trouble requesting dynamic form names. Heres the code to generate the input fields: $fields = mysql_result($result,$i,"fields"); $exFields = explode(",", $fields); for($i = 0; $i < count($exFields); $i++){ echo "$exFields[$i] : <input type=\"text\" name=\"$exFields[$i]\"> <br>"; } Ok so it generates the fields the way I want. (design crap will be done later) But I am having issues on processing the form, for example: Fields get generated -> Client Fills them in -> Submitted into our already built function. The function takes those form values and creates an XDF file with the correct requested values. But like I said I am having issues requesting the form values because they wont be static they will differ depending on each PDF. Can anyone point me in the direction on how to get the form values? how do I make this form here have a limit on the value's name, then it moves to the next line? Code: [Select] <form action=\"reply.php?com_id=$com_id\" method=\"post\"> <font color='brown'><u><input type=\"submit\" name ='submit' class=\"link\" value='$title'></u></font> </form> guys, I have looked on google for this and apparently noone is doing it. I have 4 checkboxes and I want to send mail indicating which boxes were checked. the only code I've found is PHP that captures the *status* of the boxes, such as "on" or "off". I want to capture the names of the actual checkbox elements. Here is the code I'm currently testing (which just prints out "on" or "off" to indicate which boxes are checked): if(isset($_POST['checkboxes'])) { foreach($_POST['checkboxes'] as $selected){ echo $selected . "</br>"; } } else { echo "No Desired Contact Time Specified."; } if I check all 4 boxes for instance, I get this: on on on on any way to get the names? thanks! My Php Buddies, I have mysql tbl columns these:
id: Now, I want to display their row data by excluded a few columns. Want to exclude these columns: date_&_time account_activation_code account_activation_status id_verification_video_file_url password
So, the User's (eg. your's) homepage inside his account should display labels like these where labels match the column names but the underscores are removed and each words' first chars CAPITALISED:
Id: 1
For your convenience only PART 1 works. Need help on Part 2 My attempted code:
PART 1 <?php // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } // Query to get columns from table $query = $conn->query("SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = 'members' AND TABLE_NAME = 'users'"); while($row = $query->fetch_assoc()){ $result[] = $row; } // Array of all column names $columnArr = array_column($result, 'COLUMN_NAME'); foreach ($columnArr as $value) { echo "<b>$value</b>: ";?><br><?php } ?> PART 2 <?php //Display User Account Details echo "<h3>User: <a href=\"user.php?user=$user\">$user</a> Details</h3>";?><br> <?php $excluded_columns = array("date_&_time","account_activation_code","account_activation_status","id_verification_video_file_url","password"); foreach ($excluded_columns as $value2) { echo "Excluded Column: <b>$value2</b><br>"; } foreach ($columnArr as $value) { if($value != "$value2") { $label = str_replace("_"," ","$value"); $label = ucwords("$label"); //echo "<b>$label</b>: "; echo "$_SESSION[$value]";?><br><?php echo "<b>$label</b>: "; echo "${$value}";?><br><?php } } ?> PROBLEM: Columns from the excluded list still get displayed. Edited November 19, 2018 by phpsaneHi all,
I'm having trouble attempting to increment values in an array...
$current = 5;
$next = array( I am trying to keep track of how many times a page is loaded for debugging. Here is my code but it doesn't seem to work?! Code: [Select] <?php isset($counter) ? $counter++ : $counter=1; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Page A</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </head> <body> <h3>Add a Comment</h3> <form action="Processing.php" method="post"> <fieldset> <!-- Comment --> <label>Comment:</label><br /> <textarea cols="50" rows="15"><?php echo $counter; ?></textarea> <br /> <!-- Submit Form --> <input type="submit" name="addComment" id="addComment" value="Add a Comment"/> </fieldset> </form> </body> </html> What am I doing wrong? Debbie Okay, for my bbcode parser, I run through [img tags with: Code: [Select] $text = preg_replace( "#\[img\](.+?)\[/img\]#ie" , "\\regex_check_image('\\1')" , $text ); It goes to my function regex_check_image: Code: [Select] function regex_check_image($url="") { if (!$url) return; $url = trim($url); $default = "[img]".$url."[/img]"; //-- mod_sec_update_131 begin $default = "[img]".str_replace( '[', '&# 091;', $url )."[/img]"; //-- mod_sec_update_131 end $image_count++; echo $image_count; exit; if ($image_count > 6) { message('You have posted to many Images'); exit; } if (preg_match( "/[?&;\<\[]/", $url)) { message('No Dynamic Images'); exit; } if (preg_match( "/javascript(\:|\s)/i", $url )) { message('No Dynamic Images'); exit; } // Is it a legitimate image? if (!preg_match( "/^(http|https|ftp):\/\//i", $url )) { message('No Dynamic Images'); exit; } // If we are still here.... $url = str_replace( " ", "%20", $url ); return "<img src='$url' border='0' />"; } Everything works fine, but for some reason, Code: [Select] $image_count++; echo $image_count; exit; if I have like 20 [img tags with images in them, I try to debug it, and echo it out, and it only shows "1" it should show how many [img tags I have, so I can echo out if somone is trying to spam images with the [img tag, any help? Hey guys, I have set a quiz up that pulls questions and answers from an array, every correct answer,.... score increments; however it is within a loop. Something must be wrong with the loop as it keep incrementing however i cant see why. Any help would be great, The main aim what i am trying to do is have 5 questions answered and go to different page (different topic for 5 more questions) however keep the on going score. Hope this makes sense. If not ill try and clear it up. Thanks for all your help guys in advance, i appreciate it also not, i have a functions.php, questionsandanswers.php Code: [Select] <?php session_name("Question_Test"); session_start(); echo $_SESSION['score']; require_once('questionsandanswers.php'); require_once('functions.php'); if (!isset($_POST['submit'])) { $score = 0; $_SESSION['score'] = $score; $_SESSION['correct'] = array(); $_SESSION['wrong'] = array(); $_SESSION['finished'] = 'no'; if (isset($_SESSION['error'])) { unset($_SESSION['error']); $num = 0; } else { $score = 0; $_SESSION['score'] = $score; $_SESSION['correct'] = array(); $_SESSION['wrong'] = array(); $_SESSION['finished'] = 'no'; $num = 0; } } else { $num = (int) $_POST['num']; $postedanswers = str_replace("_"," ",$_POST['answers']); if ($postedanswers == $answers[$num]['0']) { $_SESSION['score'] ++; $_SESSION['correct'][] = $postedanswers; } else { $_SESSION['wrong'][] = $postedanswers; } if ($num < count($questions)-1) { $num++; } else { $last = true; $_SESSION['finished'] = 'yes'; } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>running an array</title> <?php if (!isset($last)) { echo "<script type=\"text/javascript\" src=\"form.js\"></script>"; } ?> </head> <body> <h1>Protection Section</h1> <?php if (!isset($last)){?> <h2>Questions <?php echo $num+1; ?>:</h2> <p><strong><?php echo $questions[$num]; ?></strong></p> <form id="questionBox" method="post" action="test1.php"> <?php $pattern = ' '; $replace = '_'; $shuffledAnswers = shuffle_assoc($answers[$num]); #var_dump($newanswers); foreach ($shuffledAnswers as $answer) { $answer2 = str_replace($pattern,$replace,$answer); echo "<li><input type=\"radio\" id=\"$answer2\" value=\"$answer2\" name=\"answers\" />\n"; echo "<label for=\"$answer2\">$answer</label></li>\n"; } ?> <input type="hidden" name="num" value="<?php echo $num; ?>" /> <input type="submit" id="submit" name="submit" value="Submit Answer" /></p> </form> <?php } else { echo "your final score is:</h2>\n <h3>{$_SESSION['score']}/20</h3><h4>Verdict:</h4>"; if($_SESSION['score'] <= 5) echo "<p id=\"verdict\"><span>S</span>everely <span>H</span>indered <span>I</span>n the <span>T</span>est!</p>\n"; if(($_SESSION['score'] > 5) && ($_SESSION['score'] <= 10)) echo "<p id=\"verdict\"><span>C</span>ould <span>R</span>ead <span>A</span>nd <span>P</span>ractice more.</p>\n"; if(($_SESSION['score'] > 10) && ($_SESSION['score'] <= 15)) echo "<p id=\"verdict\"><span>A</span>cronyms a<span>R</span>e <span>S</span>o <span>E</span>asy!</p>\n"; if($_SESSION['score'] > 15) echo "<p id=\"verdict\"><span>S</span>uper <span>A</span>cronym <span>S</span>pecialist</p>"; echo "<p id=\"compare\"><a href=\"test2.php\">Next Section! <img src=\"images/arrow.png\" /></a></p>"; } ?> </body> </html> hey guys. Hopefully someone can help me with this. I have been trying to figure out for a while now why the quiz score keeps incrementing even if i refresh the page. so far there is 2 quiz sections, firstly $_SESSION['score']; is incremented on every correct answer then this information is carried on to the second part of the quiz which increments $_SESSION['score'1]; However everytime a page is refreshed then it increments again. How can i get around this? Also note i have a questions and answers section (array of q's and a's) and a functions page. Any help would be great. Thanks in advance Lance Code: [Select] <?php session_name("Question_Test"); session_start(); $_SESSION['score']; require_once('questionsandanswers2.php'); require_once('functions.php'); if (!isset($_POST['submit'])) { $score1 = 0; $_SESSION['correct'] = array(); $_SESSION['wrong'] = array(); $_SESSION['finished'] = 'no'; if (isset($_SESSION['error'])) { unset($_SESSION['error']); $num = 0; } else { $score1 = 0; $_SESSION['score1'] = $score1; $_SESSION['correct'] = array(); $_SESSION['wrong'] = array(); $_SESSION['finished'] = 'no'; $num = 0; } } else { $num = (int) $_POST['num']; $postedanswers = str_replace("_"," ",$_POST['answers']); if ($postedanswers == $answers[$num]['0']) { $_SESSION['score1'] ++; $_SESSION['correct'][] = $postedanswers; } else { $_SESSION['wrong'][] = $postedanswers; } if ($num < count($questions)-1) { $num++; } else { $last = true; $_SESSION['finished'] = 'yes'; } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>running an array</title> <?php if (!isset($last)) { echo "<script type=\"text/javascript\" src=\"form.js\"></script>"; } ?> </head> <body> <?php if (!isset($last)){?> <h1>Detection Section</h1> <h2>Questions <?php echo $num+1; ?>:</h2> <p><strong><?php echo $questions[$num]; ?></strong></p> <form id="questionBox" method="post" action="test2.php"> <?php $pattern = ' '; $replace = '_'; $shuffledAnswers = shuffle_assoc($answers[$num]); #var_dump($newanswers); foreach ($shuffledAnswers as $answer) { $answer2 = str_replace($pattern,$replace,$answer); echo "<li><input type=\"radio\" id=\"$answer2\" value=\"$answer2\" name=\"answers\" />\n"; echo "<label for=\"$answer2\">$answer</label></li>\n"; } ?> <input type="hidden" name="num" value="<?php echo $num; ?>" /> <input type="submit" id="submit" name="submit" value="Submit Answer" /></p> </form> <?php } else { $_SESSION['finalscore'] = $_SESSION['score'] + $_SESSION['score1']; echo "your final score is:</h2>\n <h3>{$_SESSION['finalscore']}/20</h3><h4>Verdict:</h4>"; if($_SESSION['finalscore'] <= 5) echo "<p id=\"verdict\"><span>S</span>everely <span>H</span>indered <span>I</span>n the <span>T</span>est!</p>\n"; if(($_SESSION['finalscore'] > 5) && ($_SESSION['finalscore'] <= 10)) echo "<p id=\"verdict\"><span>C</span>ould <span>R</span>ead <span>A</span>nd <span>P</span>ractice more.</p>\n"; if(($_SESSION['finalscore']) && ($_SESSION['finalscore'] <= 15)) echo "<p id=\"verdict\"><span>A</span>cronyms a<span>R</span>e <span>S</span>o <span>E</span>asy!</p>\n"; if($_SESSION['finalscore'] > 15) echo "<p id=\"verdict\"><span>S</span>uper <span>A</span>cronym <span>S</span>pecialist</p>"; echo "<p id=\"compare\"><a href=\"test2.php\">Next Section! <img src=\"images/arrow.png\" /></a></p>"; } ?> </body> </html> I'm having troubles incrementing a date by one day using the following format: 11-17-2011 (m-d-Y) I am attempting to use the following script: Code: [Select] $time = strtotime("11-17-2011"); $final = date("m-d-Y", strtotime("+1 day", $time)); When i echo $final i get a whole different date "01-01-1970" Now if i switch the format around to the following: Code: [Select] $time = strtotime("2011-11-17"); $final = date("Y-m-d", strtotime("+1 day", $time)); and i echo $final i get the right date but in that format (2011-11-18). Is there a way i can get the date in the first format?(m-d-Y) Hey, just wondering what would be the best way of adding .1 to a string. For example: Code: [Select] $newversion = $currentversion + '0.0.1'; $newversion is taken from a db, lets say for this example it is 0.2.1 This code simply outputs 0.2 Any ideas? Thanks =) Hi all - hoping somebody can see this clearer than me... Goal: to create a very simple shopping cart page that receives $_POST info and stores it as an array in a session variable so items will be displayed in cart on clients return to shopping cart page. Problem: I can get the array to display the first item that I add to the shopping cart but each susequest item just overwrites the first because it is using the same session variable name. How do I store the next product info in a DIFFERENT session variable and display it on the shopping cart page without writing over the first? I have two pages with products on them which need to submit orders to the shopping cart page. They use a simple form with these fields: <form method="post" action="cartaction.php"> <p> <input type="submit" name="submit" value="Buy" /> <input type="hidden" name="cartaction" value="add" /> <input type="hidden" name="item" value="coppercasserole" /> </p> </form> This is what I have so far on the cartaction page which can display the first product added to the cart: <?php //If form is submitted, call the function and save all data into the array $_SESSION['form'] if($_POST['submit'] == "Buy"){ setSessionVars(); } function setSessionVars() { if ( !isset($_SESSION['cart']) ) $_SESSION['cart'] = array(); $item = array(); foreach($_POST as $fieldname => $fieldvalue) { $item[$fieldname] = $fieldvalue; } $_SESSION['cart'] = $item; echo "<table> <tr> <td>" .'<img src="images/'.$item['item'].'.jpg"' . "<td/> <td>" . $item['item'] . "</td> <td>" . '<input type="text(30)" name="value" value="1" /> <input type="submit" name="puchasednum" value="Update This One Item" />' . "</td> </tr> </table>"; } ?> I am new to PHP and have hit a brick wall as to how to display each product array as a new session variable in the shopping cart. I would like to keep it as simple as possible as I am getting easily confused! Is there a way that I can increment the session variable with something like this: <?php //session counter $counter = count($_SESSION['cart']); if (($_POST['name'] !="")){ $counter = $counter + 1; $_SESSION['cart'][$counter] = array(); } ?> Or can I pass a field as a product ID and use this somehow to create a new session variable for each product or clear the post variables somehow? Any help would be much appreciated? Thanks i have a slider that shows 2 images at a time. i did a query and got all my images names from the database to be in an array so i can go form index zero to the last image incrementing by +1 but not working. what it is doing now is displaying index[0] and index[1] in the first set of 2 images in the second set is displaying index[1] and index [2] in the third set is displaying index[2] and index[3] and so on... here's my query Code: [Select] require_once('connections.php'); mysql_select_db($dbname, $db); $sql = "SELECT * FROM table WHERE image IS NOT NULL LIMIT 6"; //limiting to six for testing only, will remove afterwords $results = mysql_query($sql, $db) or die(mysql_error()); $row = mysql_fetch_assoc($results); // $result2 = mysql_query("SELECT * FROM table WHERE image IS NOT NULL LIMIT 6"); $storeArray = Array(); while ($row2 = mysql_fetch_array($result2, MYSQL_ASSOC)) { $storeArray[] = $row2['image']; } ?> here's the html/php Code: [Select] <?php $index = 0;?> <?php do { ?> <div class="slide"> <div class="slidePromo"> <div class="promoImg"><a href="#"><img src="<?php echo $storeArray[$index];?>"/></a> </div> </div> <!--end slide--> <div class="slidePromo"> <div class="promoImg"><a href="#l"><img src="<?php echo $storeArray[++$index];?>"/></a></div> </div> </div> <!--end slide--> <?php } while ($row = mysql_fetch_assoc($results)); ?> Basically I'm trying to set up a shopping cart using PHP & MySql (oh really!?) and I've gotten to the point where I need to insert the bought products into a database. Currently, at the checkout, there is a session which stores data for all of the products which have been added into the cart. From here I am just trying to create an order id code that is only relevant to this session. So in the database it would end up looking something like this: order_id = 001, product_id = 2, order_quantity = 3 order_id = 001, product_id = 4, order_quantity = 2 order_id = 001, product_id = 1, order_quantity = 5 order_id = 002, product_id = 2, order_quantity = 3 order_id = 002, product_id = 4, order_quantity = 2 order_id = 002, product_id = 1, order_quantity = 5 So I would be able to pull these results later by selecting the order relevant to the order_id. At least I think this is the easiest option for me. Every product which is put into the cart has a $_SESSION name of 'product_x', 'x' being the id associated with that product Any help? I'm working on a dating website for tablets, pretty simple stuff, mostly the purpose on my end aside from hoping to make money from traffic / photos is learning about sockets, dragging and in this case automatic payment system.
The ideal plan is that a person is limited to their verification photo and a free photo file upload (fake women haha), and then for just a meager price of $0.20 each, an extra photo slot. Ideally they are not limited to how many photos they can post hence I created a table of just photos with a username, then incrementing number of photos.
Anyway, the plan is (despite how absurd it might seem), the person buys a photo slot, which they can freely modify, it's just a photo slot, for $0.20 and this is done through paypal and their credit card information is "stored" (yeah sketchy) for future purchase convenience.
I'm just looking for some input about this, you don't have to write the code, I haven't gotten to this part yet but if anyone has experience with automatic payment system and php/sql database cause-and-effect sort of automation...
If this thread is deleted I'll understand.
I did say absurd like "Who is going to buy a photo slot?" but it's not about that, the site isn't about "how many photos" you have or "profiles" really it's a lazy dating site, just skip, skip, skip, ooohhh, message, sort of thing and additionally if a person is so inclined, sees that there are more photos of this person... I think it's a pretty good idea having a mandatory selfie that people have to take to prove they are not a bot.
This is also useful for people to "verify" this person, so they see the mandatory photo selfie then compare it to the uploaded photos which may have obviously been altered. Yeah it doesn't sound like a sound "business plan" like who wants to "be themselves" but as I said, it is primarily a learning experience on my part. And an excuse to use my tablet that I recently purchased.
I have a row in a MySQL table called id, which auto-increments. I was wondering if anyone knows a PHP solution to find out what the highest number in the row is? I am thinking perhaps execute a MySQL query that will list the highest number, and then echo the result, like $row[id] in PHP? Im trying to write some code for a raffle, when someone buys one ticket it works well but if someone buys ten tickets. i would like it to put each one on a new row, the last column is the ticket number which is got by another table called count and i want the new count in the last column of each row. In the actual script there is more than two columns but this is an example just to try to let you know what im trying to do. As you can see i want the ticket number to increment by one every time someone buys tickets. (the ticket number is in a simple table with just id and ticket number) EXAMPLE someone buys 2 tickes name | ticket number John | 1 john | 2 then someone buys three tickets jane | 3 jane | 4 jane | 5 This is what i have. (WORKING EXAMPLE of the code tha doesnt work.) as you can see the ticker number stays the same and not increment by one. <?php $num //is a number between 1 and 10 $tr //is the current count got from database (this needs to count up by one every entry) include 'includes/connect.php'; $num = "3"; // number of tickets someone buys. $count = "5"; // count of tickets already sold (so this is start count for this transaction). $id = "1"; // this is the line the counter is on to keep count updated for the amount of tickets sold. $name = 'john'; //example name for($i=0;$i< $num;$i++){ $count="$count+1"; // increments count by 1 $sql123 = "UPDATE count SET count=$count WHERE id='$id'"; //should update database to new count $sql = "INSERT INTO test (name, number) VALUES ('$name', '$count')"; if($result = mysqli_query($con, $sql)){ echo "<br>tickets bought and entered into database,<br>Thank you<br>"; } else { echo "Error: " . $sql . "<br>" . $con->error; } } ?> Not sure what im doing wrong? Thank you in advance Nook6 Hi, I have db table that records the days (Sunday, Monday...) when the employee login to the system. Say that the employee logged in on Monday then Logged in on Wednesday so this means he was absent on Tuesday. I calculated the number of days to get the answer 2 (between Wednesday and Monday before logging in on Wednesday) how to get the name of the missing day "Tuesday"? code: $curdate = date("Y-m-d"); $currday = date('l'); $lastdate = $row['indate']; $lastdayin = $row['lastdayin']; if ($lastdate !=Null) { $misseddates = strtotime($curdate) - strtotime($lastdate); $misseddates = $misseddates / 86400; echo $misseddates; $misseddays = strtotime($lastdayin) - strtotime($currday); $misseddays = $misseddays / 86400; echo $misseddays; } I tried to get the name of day in the last step but it only calculates 5 in numbers how to get the name. I want the answer to be "Tuesday" as of the example. Thanks. Hey , I'm looking for functions names from the GD directory. 1.function that open image. 2.function that getting pixel color. 3.function that changing pixel color. thanks. |