Jump to content

Search the Community

Showing results for tags 'advice'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 4 results

  1. Hi all, I am looking at the possibility of setting up a coding school for young people in the third world. I am not a coder or programmer at all and would like suggestions as the best way to teach these skills. Do I need a competent teacher or are there reputable comprehensive online courses available. I could certainly provide the IT hardware and connectivity. How do most coders in the USA gain their skills? Are most of them graduates? Lastly, which institutions in the US might provide funding for a project like this? Where could I start looking? This will be a non profit venture. Any help/advice will be gratefully received.
  2. Hey guys and girls, I am currently following a book to create a PHP shopping cart and I am having trouble passing the data from a form to my cart script that add's the product to the cart. This is the products.php file which contains the form & action which is posting the data from the input forms 'product_qty', 'product_id', and 'req=add': <table width="100%" border="0" cellspacing="0" cellpadding="4"> <tr> <td colspan="2"> <a href="/newagedclothing/content/products.php?req=view&product_id=<?php echo $product_id; ?>"> <?php echo $product_title; ?> </a> </td> </tr> <tr> <td width="16%" align="left" valign="top"> <strong>Description:</strong></td> <td width="84%"> <?php echo $caption; ?> </td> </tr> <tr> <td align="left" valign="top"><strong>Price:</strong></td> <td> <?php echo $product_price; ?> </td><?php echo $product_id; ?> </tr> <tr> <td> </td> <td><form method="post" action="index.php?content=cart"> <strong>Add To Cart</strong> <input name="product_qty" type="text" value="1" size="2" /> <input type="hidden" name="req" value="add" /> <input type="hidden" name="product_id" value="<?php echo $product_id; ?>" /> <input type="submit" name="Submit" value="Go!" /> </form> </td> </tr> </table> <hr size="1"> This is the cart.php file: <?php $cart = &new ShoppingCart; $cart_id = $cart->get_cart_id(); switch($_REQUEST['req']){ case "add": $add2cart = $cart->cart_add($_REQUEST['product_id'], $_REQUEST['product_qty']); if(!$add2cart){ echo "<center>The product could not be ". "to your shopping cart. You may ". "have entered an invalid quantity. </center>" . $add2cart; } else { echo "<center>Item added to your shopping cart!<br />". "<a href=\"/cart.php\">View ". "your cart</a></center>"; } break; case "update": while(list($product_id, $qty) = each($_POST[qty])){ $sql = mysql_query("SELECT * FROM shopping_products WHERE product_id='$product_id'"); $row = mysql_fetch_assoc($sql); if($qty == 0){ mysql_query("DELETE FROM shopping_cart WHERE cart_identifier='$cart_id' AND product_id='$product_id'"); } if($qty > $row[product_qty]){ mysql_query("UPDATE shopping_cart SET product_qty='{$row[product_qty]}' WHERE cart_identifier='$cart_id' AND product_id='$product_id'"); $error = TRUE; $products[$product_id] = stripslashes($row[product_title]); } else { mysql_query("UPDATE shopping_cart SET product_qty='$qty' WHERE cart_identifier='$cart_id' AND product_id='$product_id'"); } } if($error){ echo "<center>You have selected more than our current stock for the following product(s): <br />"; while(list($product_id, $product_title) = each($products)){ echo "<a href=\"/products.php?req=view&product_id=$product_id\">$product_title</a><br />"; } echo "<br />"; echo "We have updated your quantity to the maximum value that we have in stock.</center><br />"; echo "<center><a href=\"/cart.php\">Back to cart</a></center>"; } else { header ("Location: /cart.php"); } break; case "remove": $sql = mysql_query("DELETE FROM shopping_cart WHERE cart_identifier='$cart_id' AND product_id='{$_REQUEST['product_id']}'"); header("Location: /cart.php"); break; case "empty_confirm": echo "<center>Are you sure you want to empty your cart?<br />". "<a href=\"cart.php?req=empty\">Yes</a>". " | ". "<a href=\"/cart.php\">No</a></center>"; break; case "empty": $cart->empty_cart(); echo "<center>Your cart has been emptied!</center>"; break; default: if($cart_id){ $num_items = mysql_result(mysql_query("SELECT COUNT(*) as items FROM shopping_cart WHERE cart_identifier='$cart_id'"),0); if($num_items == 0){ echo "<center>Your shopping cart is empty!</center>"; exit(); } } else { echo "<center>Your shopping cart is empty</center>"; exit; } ?> <p>Your shopping cart</p> <p>This page allows you to modify or empty your shopping cart contents. Simply change the number of each product you wish to purchase and select the "update cart" link at the bottom.</p> <form name="update" method="post" action="/cart.php"> <table> <tr> <td>Qty</td> <td>Product</td> <td align="right">Price</td> <td align="right">Product Total</td> </tr> <?php $total = mysql_result(mysql_query("SELECT sum(product_qty * product_price) AS subtotal FROM shopping_cart WHERE cart_identifier='$cart_id'"), 0); $total = number_format($total, 2); $sql = mysql_query("SELECT * FROM shopping_cart WHERE cart_identifier='$cart_id'"); while ($row = mysql_fetch_array($sql)) { $product_total = number_format(($row[product_qty] * $row[product_price]), 2); echo "<tr><td><input type=\"text\" " . "name=\"qty[$row[product_id]]\" " . "size=\"2\" value=\"$row[product_qty]\" />" . "<br /><a href=\"/cart.php?req=remove&" . "product_id=$row[product_id]\">" . "Remove</a>" . "</td>" . "<td><a href=\"/products.php?req=view&product_id=$row[product_id]\">" . stripslashes($row[product_title]) . "</a></td>" . "<td align=\"right\">\$$row[product_price]</td>" . "<td align=\"right\">\$$product_total</td>" . "</tr>"; } ?> <tr> <td colspan="2"> </td> <td align="right">Total:</td> <td align="right">$<?=$total ?>< /td> </tr> <tr> <td colspan="4" align="center"> <a href="javascript:void(document.update.submit())">Update Cart</a> | <a href="/cart.php?req=empty_confirm">Empty Cart</a> | <a href="/products.php">Continue shopping</a> | <a href="/checkout.php">Checkout</a> </td> </tr> </table> </form> <?php break; } ?> Here is the add_cart function: function cart_add($product_id, $product_qty){ $cart_id = $this->get_cart_id(); if(!$cart_id){ //if no cart id found, generate one $unique_cid = md5(uniqid(rand(),1)); //set cart id into cookie setcookie('cid', $unique_cid, time()+24*3600*60); //Register session with cart id value $_SESSION['cid'] = $unique_cid; //if persion is a member //modify their profile with //cart id in the database if($_SESSION['login']){ $_SESSION['cid'] = $unique_cid; @mysql_query("UPDATE members SET cart_id='$unique_cid' WHERE id='".$_SESSION['userid']."'"); } }//end generate unique id $sql_get_product = mysql_query("SELECT * FROM shopping_products WHERE product_id='$product_id'"); $sql_check = mysql_query("SELECT * FROM shopping_cart WHERE cart_identifier='{$_SESSION['cid']}' AND product_id='$product_id'"); while($row = mysql_fetch_array($sql_check)){ $products = mysql_fetch_assoc($sql_get_product); if(($product_qty + $products[product_qty]) > $products[product_qty]){ $new_qty = $products[product_qty]; } else { $new_qty = ($product_qty + $row[product_qty]); } $sql = mysql_query("UPDATE shopping_cart SET product_qty='$new_qty', date = now() WHERE id='{$row['id']}'"); $skip = TRUE; } if(!$skip){ $products = mysql_fetch_assoc($sql_get_product); if($products[product_qty] < $product_qty){ $product_qty = $products[product_qty]; } if($product_qty > 0){ $sql = mysql_query("INSERT INTO shopping_cart (cart_identifier, product_id, product_title, product_qty, product_price, date) VALUES ('{$_SESSION['cid']}', '$product_id', '{$products['product_title']}', '$product_qty','{$products['product_price']}', now())"); } else { $sql = FALSE; } } if(!$sql){ return FALSE; } else { return TRUE; } }//end cart_add() My problem is that whenever I click the 'add' button to send the data across it seems like it isn't being sent correctly. I'm am a bit unsure on how to structure the url for the submit button and I think it's to do with that. These pages are being controlled around my index.php file and the products page url looks like this, 'index.php?content=products'. All my content files are in a folder named 'content'. Please ask for any other questions to aid my assistance. Much appreciated ! Sam
  3. Hi, I am Alfredo and I am 11 years old. I really want to lean php and other web development things. But I get confused when I see there are so many things. Makes my head spin. Tried w3 school, lynda.com. But as you people know php and all other stuffs in web development are huge and too much elaborate. I need a clear guide line. One day I start one thing and next day another. Eventually I am learn nothing All I want to become a good web developer. Please suggest me what should I do. Which thing I should start 1st, like html etc. and from where (lynda.com ; w3school; for dummies book ; youtube) Please give me some advice beginning to end (to become good web developer) Please help me and thank you, Alfredo off the topic: How much time a day I should spend on learning if I want to become a web developer in a year? [i know this is a stupid question but would love to know]
  4. There is 2 parts to this post. The first part is this: I'm making a social network with followers on it. I want to people to be able to follow each other, so I have a database and a table of users. I've thought about how it would be possible for someone to follow a lot of people (say millions if they wanted to). My first thought was to create a table and just make 1 column for the username of the person and then add a bunch of columns of the usernames that person is following...but that's inefficient. So I needs ideas and advice on the code. Is there a possible way that when a person follows someone the system checks to see if that person has followed anyone else and if not they it puts their username in the first column and then puts the followee's username in the next column. Then when they follow someone else it look up the followers username name and just adds the next followee's username into the columns after the last followee? That way I don't have to have a set number of people that users can follow. Then there is the "news feed" part. I want to create a "news feed" that displays the posts of all the people the user follows. I have a table of posts that are flagged by the authors username and I WILL have the table of people the user follows. Any ideas on how to make the feed display in order what the peoples posts are that the user follows?
×
×
  • 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.