Jump to content

shyam13

Members
  • Posts

    39
  • Joined

  • Last visited

    Never

Everything posted by shyam13

  1. Hi All, I am trying to use a while loop to retrieve all the data within my database table, I want to put the data into a list but when I run my code nothing shows up on the screen, I dont know what the problem could be? Code: $result = mysql_query("SELECT * FROM insects"); while($row = mysql_fetch_array($result)) ?> <ul> <li><?php echo $row['insect_science'];?></li> <li<?php echo $row['insect_com'];?></li> </ul>
  2. shyam13

    Help!

    I am trying to pull data from a database using the insect_id which is sent to the url, below is my code: insect.php: <?php require_once('includes/php/require.php'); $insect = mysql::select('insects',NULL, condition::where('insect_vis')->is(1)->and(condition::where('insect_web')->is(2))); if (isset($_GET['insect_id'])) $insect->condition->and(condition::where('insect_id')->is($_GET['insect_id'])); $insect = $insect->order('insect_slug asc')->limit(10)->execute()->row(0); ?><!DOCTYPE HTML> <html> <head> <meta charset='utf-8'> <title></title> <meta name='description' content='' /> <script type='text/javascript' src='/includes/js/jquery.min.js'></script> <script type='text/javascript' src='/includes/js/jquery-ui.min.js'></script> <script type='text/javascript' src='/includes/js/index.js'></script> <link href='/includes/css/jquery-ui.css' rel='stylesheet' type='text/css' /> <link href='/includes/css/reset.css' rel='stylesheet' type='text/css' /> <link href='/includes/css/index.css' rel='stylesheet' type='text/css' /> <link href='/includes/css/header.css' rel='stylesheet' type='text/css' /> <link href='/includes/css/navigation.css' rel='stylesheet' type='text/css' /> <link href='/includes/css/blog.css' rel='stylesheet' type='text/css' /> <link href='/includes/css/cart.css' rel='stylesheet' type='text/css' /> <link href='/includes/css/footer.css' rel='stylesheet' type='text/css' /> <link href='/includes/css/insecttable.css' rel='stylesheet' type='text/css' /> </head> <body> <div class='wrapper'> <?php include('fragments/header.php'); ?> <?php include('fragments/navigation.php'); ?> <div class='content overflow'> <div class='left small articles'><ul><h1>insects</h1> </div> </div> <div class='right large'> <h2>Insect</h2> <ul class='insecttable'><?php $insect = mysql::select('insects', NULL, condition::where('insect_web')->is(2)->and(condition::where('insect_vis')->is(1))); foreach($insect->order('insect_science')->execute()->data as $insect) { ?> <ul><li><form method='get' class='insect'> <a href='/insectcientific/<?php echo $insect['insect_id']; ?>'> <div> <strong><?php echo $insect['insect_science']; ?></strong><br /> <?php echo $insect['insect_com']; ?> </div> </a> <?php if (mysql::select('insects', 'insect_id', condition::where('insect_id')->is($insect['insect_id'])->and(condition::where('insect_vis')->is(1)))->limit(10)->execute()->row()) { ?> <a href='/insectcientific/<?php echo $insect ['insect_id']; ?>' class='button inline'>Details</a> <?php }?> </form></li> <?php } ?></ul> </div> <?php include('fragments/footer.php'); ?> </div> </body> </html> insectscientific.php: <?php require_once('includes/php/require.php'); if(isset($_GET['insect_id'])){ $insect = mysql::select('insect', 'insect_slug, insect_science, insect_com, insect_mdes', condition::where('insect_id')->equalto($_GET['insect_id']))->and (condition::where('insect_vis')->equalto(1))->execute(); ?> <?php } ?> <html> <head> <meta charset='utf-8'> <title></title> <meta name='description'/> <script type='text/javascript' src='/includes/js/jquery.min.js'></script> <script type='text/javascript' src='/includes/js/jquery-ui.min.js'></script> <script type='text/javascript' src='/includes/js/index.js'></script> <link href='/includes/css/jquery-ui.css' rel='stylesheet' type='text/css' /> <link href='/includes/css/reset.css' rel='stylesheet' type='text/css' /> <link href='/includes/css/index.css' rel='stylesheet' type='text/css' /> <link href='/includes/css/header.css' rel='stylesheet' type='text/css' /> <link href='/includes/css/navigation.css' rel='stylesheet' type='text/css' /> <link href='/includes/css/blog.css' rel='stylesheet' type='text/css' /> <link href='/includes/css/cart.css' rel='stylesheet' type='text/css' /> <link href='/includes/css/footer.css' rel='stylesheet' type='text/css' /> <link href='/includes/css/insects.css' rel='stylesheet' type='text/css' /> </head> <body> <div class='wrapper'> <?php include('fragments/header.php'); ?> <?php include('fragments/navigation.php'); ?> <div class='content overflow'> <div class='left small articles'><ul><h1>insects</h1> </div> </div> <div class='right large'> <?php $data = mysql::select('insect','insect_slug, insect_science, insect_com, insect_mdes', condition::where('insect_web')->equalto(2)->and(condition::where('insect_vis')->equalto(1)))->execute()->row(); ?> <strong style='color:white'><?php echo $blog['insect_mdes']; ?></strong> </div> <?php include('fragments/footer.php'); ?> </div> </body> </html> I can access the other page but when I select an item from my insect page the id is sent to the url but the data is not retrieved from the database using the url. Any help?
  3. I have created a table where you can select insects and the insect_slug will be sent to the URL for example: www.website.com/insectscientific/acrolepiopsisassectella, when user then clicks on the product they will be redirected to another page where, if the URL slug is same to the insect slug in the database display the information for that product. Code: <?php if ($_GET['insect_slug'] === ($insect['insect_slug'])); echo $insect['insect_mdes']; ?>
  4. Can you use a Get Method inside a if statement and if you can, how would this be possible? Thank You
  5. shyam13

    Floating Div

    Thank you
  6. shyam13

    Floating Div

    I done the float for the div, but if I wanted it to fade out when someone access the form, Would I use jquery and javascript?
  7. If I use this method, Would it be able to create a new div for each element?
  8. shyam13

    Floating Div

    If I wanted to make the form fade out when a button is pressed from another form, would I use the same method?
  9. How do I insert data which I retrieved from the database using a select statement and then using a for each loop insert the data into separate divs, so far I have used a select statement to get the data but I am struggling to use the for each loop to insert the data into separate divs. Any ideas anyone?
  10. shyam13

    Floating Div

    How do you create a floating div? Thank you
  11. Hi All, I am trying to create a call to action feature on my website, I am trying to send data from one form to another by using the post function and on the second form when the user clicks submit the data should be sent to the database, I can send data to the other form when they submit the data the data is not sent to the database, What could be the problem? code: <div class="callback" style='width:150px'> <form action='calltoaction.php' method='post'> <table width='320' border="1"> <tr> <td width='139'> <p>Next Step</p> <p>Connect with Us</p> </td> <td rowspan='2'> <textarea name='user_question' rows='4' placeholder='Please ask a question and we will respond as quick as possible' value='<?php echo $_POST['user_question'] ?>'></textarea> </td> </tr> <tr> <td> <input name='user_name' placeholder='Please enter your name' class='required' required value='<?php echo $_POST['user_name'] ?>' /> </td> </tr> <td align='center'> <input type='submit' value='ask a question' /> </td> <tr> <td><input name="website_id" type="hidden" value="1" /></td> </tr> </tr> </table> </form> </div> Calltoaction: <div class="callback" style='width:150px'> <form method='post'> <table width='320' border="1"> <tr> <td width='250'> <p>Next Step</p> <p>Connect with Us</p> <tr> <td><input name='user_name' type='text' placeholder='Please enter your name' class='required' required value='<?php echo $_POST['user_name'] ?>'/></td> </tr> <tr> <td><textarea name='user_question' rows='4' placeholder='Please ask a question and we will respond as quick as possible' value='<?php echo $_POST['user_question'] ?>'></textarea></td> </tr> <tr> <td><input name='call_email' type='text' placeholder='Please enter your email' class='required' required value='<?php echo $_POST['user_email'] ?>'/></td> </tr> <tr> <td><input name='call_callback' class='datepicker' placeholder='best time for callback' value='<?php echo $_POST['call_calback'] ?>'/>optional</td> </tr> <tr> <td><input name='call_tel' type='text' placeholder='telephone number' value='<?php echo $_POST['call_tel'] ?>' />optional</td> </tr> </td> </tr> <td align='right'> <button name='submit' type='submit'>Submit query</button> </td> </tr> </table> </form> </div> Thank You
  12. I created an ht access file for my website and I made a few adjustment to the file and now my website has crashed, I can access some web pages and when I access other web pages, they show a 404 error, please help This is the code for my htaccess file: RewriteEngine on RewriteBase / RewriteRule ^([A-Za-z0-9-]+)$ $1.php [NC] #Content Rule RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([A-Za-z0-9-]+)\.php$ content.php?name=$1 [L,NC,QSA] Thank you Shyam
  13. The best way to solve this problem, would mainly use MySQL and/or php, and if possible use user authentication.
  14. No its does not come from a framework. Thank You Shyam
  15. I have created a new mysql query but when I run the code on my browser and I check the inspect element and It gives an error, the error is a 500 internal server problem. here is my code: <div class='wrapper'> <div class='menu'> <ul id="menu"> <?php $first = mysql::select('menu','menu_id','menu_name',condition::where('menu_pid')->isnull())->execute(); foreach($first->data as $row){ echo $row['menu_name']; $second = mysql::select('menu','menu_id','menu_name',condition::where('menu_pid')->is($row['menu_id']))->execute(); } ?> </ul> please help Thank you Shyam
  16. I have tried using array_sum to recalculate the product quantity after each update, but the total is still the same, the total dosent get recalculated automatically. Thank You Shyam
  17. Who do you delete a product from $_SESSION['cart'] ? Thank You Shyam
  18. yes, the total is recalculated after each quantity update. Thank You Shyam
  19. I checked the logic and there seems to be a slight problem, which has now been fixed and I now able to add products to the cart. Thank you for your help Appreciate it Shyam
  20. I will have a look again, if the unset session has destroyed, would it be better to create a new session? Thank You Shyam
  21. if I use this function, will the total be able to be automatically updated when the quantity is updated? Thank You Shyam
  22. I have just reread my code, there is nothing wrong with my logic which is quite strange, i changed the code to use : <?php if (isset($_POST['clear'])) $_SESSION['cart'] = array(); ?> but I still have the same problem, no products are added to the cart. Thank you Shyam
  23. I store the cost of the product directly into the $_SESSION['cart'] Thank you Shyam
  24. This is my code: <?php if (isset($_POST['clear'])) unset($_SESSION['cart']) ?> the statement clears the cart, but when I now try and add products to the cart, nothing is getting added. Thank You Shyam
  25. Does using the UNSET Function on my shopping cart, destroy my $_SESSION['cart'] ? Thank You Shyam
×
×
  • 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.