Jump to content

vinpkl

Members
  • Posts

    448
  • Joined

  • Last visited

Everything posted by vinpkl

  1. hi zenag when i used this code <?php $qry="insert into cart_table(product_id,image,product_name,quantity,price,shipping_cost,total_cost) values('$id','$row[image]','$row[product_name]',1,'$row[price]','$row[shipping_cost]','$row[price]'+'$row[shipping_cost]')"; ?> then i received this error Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in E:\xampp\htdocs\vineet\shopping_cart.php on line 12 insert into cart_table(product_id,image,product_name,quantity,price,shipping_cost,total_cost) values('','','',1,'','',''+'')
  2. hi when i used this code <?php $qry="insert into cart_table(product_id,image,product_name,quantity,price,shipping_cost,total_cost) values(".$id.",".$row['image'].",".$row['product_name'].",".1.",".$row['price'].",".$row['shipping_cost'].",".$row['price']."+".$row['shipping_cost'].")"; ?> then i received Parse error: syntax error, unexpected T_DNUMBER in E:\xampp\htdocs\vineet\shopping_cart.php on line 13. also in concatination of ".1." one dot is red and one is blue vineet
  3. hi all i m inserting data from my product table into cart table and getting this error Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in E:\xampp\htdocs\vineet\shopping_cart.php on line 13 This is my complete code <?php require_once("config.php"); $_SESSION['product_id']=$_REQUEST['product_id']; $_SESSION['product_id']=$_REQUEST['product_id']; $id=$_SESSION['product_id']; //echo test; //exit; $qry="select product_id,image,product_name,price,shipping_cost from product_table where product_id=". $_SESSION['product_id']; //echo $qry; //exit; $result=mysql_query($qry); $row=mysql_fetch_array($result); $qry="insert into cart_table(product_id,image,product_name,quantity,price,shipping_cost,total_cost) values($id,$row['image'],$row['product_name'],1,$row['price'],$row['shipping_cost'],$row['price']+$row['shipping_cost'])"; echo $qry; exit; mysql_query($qry); ?> This is line no.13 $qry="insert into cart_table(product_id,image,product_name,quantity,price,shipping_cost,total_cost) values($id,$row['image'],$row['product_name'],1,$row['price'],$row['shipping_cost'],$row['price']+$row['shipping_cost'])"; what is causing error in my code. vineet
  4. hi all I have to scripts. One script displays the image and other script displays swf file. But both the image and swf are to displayed at the same location. so i want to toggle them. If the user uploads an image then image should displayed as image, else if the user uploads an swf file then the swf file should be displayed. here is my script that displays image $qry="select * from special_offers where location='right side'"; $result = mysql_query($qry); if(mysql_num_rows($result)>0) { while($row=mysql_fetch_array($result)) { echo "<td>". "<img height=200 width=250 src='uploads/" . $row['offer_image'] . "'/>" . "</td>"; } } Here is my script that displays swf file $qry="select * from special_offers where location='right side'"; $result = mysql_query($qry); if(mysql_num_rows($result)>0) { while($row=mysql_fetch_array($result)) { echo "<td>"; echo "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0' width='250' height='200'>"; echo "<param name='movie' value='admin/uploads/" . $row['offer_image'] ."'/>"; echo "<param name='quality' value='high' />"; echo "<embed quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='250' height='200' src='admin/uploads/" . $row['offer_image']."'>" . "</embed>"; echo "</object>"; echo "</td>"; } } how can i toggle them. i dont want to detect flash player. just display the image or swf according to the user input. vineet
  5. Hi andy Thanks for the reply. It working well as needed. vineet
  6. Hi i tried with ID also. It restricts the page to be accessed without login but the problem i m facing is that even if i have entered user and password corectly it doesnot redirect me to control_panel.php If i remove this script from control_panel.php then after entering user name and password it redirects to control_panel.php in control_panel.php i m writing if($row['id'] == "2") { header("Location:control_panel.php"); } else { // redirect to main page header("Location:index.php"); } vineet
  7. hi With this script after loggin i am redirecting the user to control_panel.php but it doesnt allow to redirect even after entering user and password correctly. vineet
  8. hi thanks for the reply. it worked well. I just wanted to know what should i write in my "logout" page. i have started session_start(); in my config.php which is included file in every admin page. vineet
  9. hi ok that is fine. One thing i want to know that i will put this code in all the admin pages except the login page. and what will be the datatype for the authority column in database vineet
  10. hi what will be the datatype to be selected for "authority" column. and where you have written in code // display page do i have to write the page name or leave it as comment vineet vineet
  11. hi i am working on admin section which has a login page with login id and pasword form. In my admin section i have many pages say like manage_products.php, description.php, control_panel.php etc. if the user have to access the manage_products.php page then he can access it just typing like the link below http://localhost/vineet/admin/manage_products.php without entering login user and pasword. i want to restrict the access of this page through admin panel only. The user should be able to access page only if he is logged in. vineet
  12. hi well its not address its detail about shipping, how many days wil it take, from where product will be shipped, about courier and all that. it can be 3 lines, may be 5 or 6. thats why i have inserted <textarea>. Here is the result -------------------- 3-7 days shipping. Product shipped from delhi. ---------------------- I want to insert <br> before Product word starts. if i didnt get any solution for <textarea> then i have to adopt your solution. vineet
  13. hi here is the code if(isset($_REQUEST['submit'])) { $shipping_detail=$_REQUEST['shipping_detail']; $warranty=$_REQUEST['warranty']; $insertqry="insert into product_table(shipping_detail,warranty) values('$shipping_detail','$warranty')"; if(mysql_query($insertqry)) $msg="shipping Product added successfully"; else $msg="Error Inserting new product"; } Here is the result -------------------- 3-7 days shipping. Product shipped from delhi. ---------------------- I want to insert <br> before Product word starts
  14. hi all i would like to ask that i have a <textarea> and in that i can insert 3 lines. If the content is entered with "pressing enter" after each line then i want that 3 lines ouput should come with a break after each line. means i just want to add <br> after each line ouput. the name of <textarea> is shipping_detail. $shipping_detail=$_REQUEST['shipping_detail']; vineet
  15. Hi thanks a lot. Its now working perfect. one thing more i would like to ask that i have a <textarea> and in that i can insert 3 lines. i just want to how can those 3 lines should come with a break after each line. means i just want to add <br> after each line. the name of <textarea> is shipping_detail. <?php echo $row['shipping_detail']; ?> vineet
  16. hi i have used this in my code but its showing the full 20 lines. if(isset($_REQUEST['submit'])) { $model=$_REQUEST['model']; $qry="select * from product_table where product_name LIKE '%$model%' "; $result = mysql_query($qry); if(mysql_num_rows($result)>0) { while($row=mysql_fetch_array($result)) { $desc = short_description($row['detail_description']); echo "<table>"; echo "<tr>"; echo "<td width=148 class=products>Image</td><td width=148 class=products>Product Name</td><td class=products width=148>Description</td><td width=148 class=products>Cutout Price</td><td width=148 class=products>Price</td>"; echo "</tr>"; echo "<tr>"; echo "<td width=125>" . "<img width=116 height=117 src='admin/uploads/" . $row['image'] . "'/>" . "</td>"; echo "<td valign=top width=125>". $row['product_name'] . "</td>"; echo "<td valign=top>". $row['detail_description'] . "</td>"; echo "<td valign=top class=cut>". "NZ$ " . $row['cutout_price'] . "</td>"; echo "<td valign=top>". "NZ$ " . $row['price'] . "</td>"; echo "</tr>"; echo "<tr>"; echo "<td valign=top colspan=5 align=right>". "<a href=description.php?id=" . $row['product_id'] . ">" ."<img src='images/details.gif' border=0 />" . "</a>" . "</td>"; echo "</tr>"; echo "<tr>"; echo "<td class=products_sep colspan=5>" . "<image src='images/spacer.gif' height=15 width=15>" . "</td>"; echo "</tr>"; echo "</table>"; } } else echo "No Results found !"; } function short_description($text, $max_lines = 4) { // standardize new lines $text = str_replace(array("\r\n", "\r"), "\n", $text); // get each line $lines = explode("\n", $text); // retieive the requires lines $list = array(); for($i = 0; $i <= $max_lines; $i++) { $list[] = $lines[$i]; } // add closing ul tag $list[] = '</ul>'; return implode("\n", $list); }
  17. hi my data is in Format 2. It contains the <ul></li> tags and the data with <li> tags. like bulleted content. <li>line 1</li> <li>line 2</li>
  18. hi all i have index page and description page. In description page i am able to show the complete list of the features of my products which are fetched from database in 20 lines. Means each product has a long description of 20 lines each. Now i want to show only 4 lines out of those 20 lines in my index page for my each product. how can i fetch only 4 lines out of those 20 lines. the name of my description field in my form is "description". vineet
  19. hi this is the new code i have replaced $qry up also and down also require_once("../config.php"); $msg=""; if(isset($_POST['id'])) { $id=$_POST['id']; //$qry="select * from admin_table where user_id=$id"; //$qry="select * from admin_table where user_id=$id LIMIT 1"; $qry="select * from admin_table WHERE `user_name`='$user_name' and `password`='$password' LIMIT 1"; $result=mysql_query($qry); $row=mysql_fetch_array($result); } if(isset($_POST['submit'])) { $user_name=$_POST['user_name']; $password=$_POST['password']; $qry="select * from admin_table WHERE `user_name`='$user_name' and `password`='$password' LIMIT 1"; $result=mysql_query($qry); echo $qry; if(mysql_num_rows($result)>0) { if(($user_name==$row['user_name']) && ($password==$row['password'])) { header("Location: control_panel.php"); /*echo "<SCRIPT language='javascript'>"; echo "window.location='control_panel.php'"; echo "</script>";*/ } else { $msg="Login ID or password is incorrect"; } } } In the echo result i got the corect user password as in database. select * from admin_table WHERE `user_name`='vineet' and `password`='23456' LIMIT 1 I didnt get mysql_numrow error that i got earlier. but it says incorect user password and didnt redirect. where i have the code $id=$_POST['id']; there also i have change it to new qry that you have sent now.
  20. Hi This is the new code require_once("../config.php"); $msg=""; if(isset($_POST['id'])) { $id=$_POST['id']; //$qry="select * from admin_table where user_id=$id"; $qry="select * from admin_table where user_id=$id LIMIT 1"; $result=mysql_query($qry); $row=mysql_fetch_array($result); } if(isset($_POST['submit'])) { $user_name=$_POST['user_name']; $password=$_POST['password']; //$qry="select user_name,password from admin_table where user_name='$user_name'"; $qry="select * from admin_table WHERE `user_name`='$user_name',`password`='$password' LIMIT 1"; $result=mysql_query($qry); echo $qry; if(mysql_num_rows($result)>0) { if(($user_name==$row['user_name']) && ($password==$row['password'])) { header("Location: control_panel.php"); /*echo "<SCRIPT language='javascript'>"; echo "window.location='control_panel.php'"; /*echo "</script>";*/ } else { $msg="Login ID or password is incorrect"; } } } I have inserted echo $qry; in the code and on submitting the result i get is select * from admin_table WHERE `user_name`='vineet',`password`='23456' LIMIT 1 Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in E:\xampp\htdocs\vineet\admin\index.php on line 24 The user and id that the code has fetched is the same as in database.
  21. hi i dont know anything about md5 and i have not used it anywhere vineet
  22. i used this but its giving error that the login or password is incorect. i have checked and matched in the database. i m filing the corect login and pasword but stil its saying its incorect. vineet
  23. hi all i have a login form with user name and password. The user name field is called "user_name" and password field is called "password". I have applied the code. If the user and password is incorect then its showing error that the user and pasword doesnot match. that is working fine. But if the user and password is corect then it doesnt redirect to file control_panel.php and neither show any error. In the database i have user_id, user_name, password. <?php require_once("../config.php"); $msg=""; if(isset($_REQUEST['id'])) { $id=$_REQUEST['id']; $_SESSION['id']=$id; $qry="select * from admin_table where user_id=$id"; $result=mysql_query($qry); $row=mysql_fetch_array($result); } if(isset($_REQUEST['submit'])) { $user_name=$_REQUEST['user_name']; $password=$_REQUEST['password']; $qry="select * from admin_table"; $result=mysql_query($qry); if(mysql_num_rows($result)>0) { if(($user_name==$row['user_name']) && ($password==$row['password'])) { //header("location:control_panel.php"); echo "<SCRIPT language=javascript>"; echo "window.location='control_panel.php'"; echo "</script>"; } else { $msg="Login ID or password is incorrect"; } } } ?>
  24. hi thanks thanks a lot. works perfect as needed. vineet hi thanks thanks a lot. works perfect as needed. vineet
×
×
  • 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.