Jump to content

smokyyyyyy

Members
  • Posts

    11
  • Joined

  • Last visited

    Never

Everything posted by smokyyyyyy

  1. HI i am new to progreamming and CodeIgniter I created a new function in CodeIgniter HTML_HELPER.PHP which can create menu when pass an array in function as parameter When i run the script it says A PHP Error was encountered Severity: Notice Message: Undefined index: menu Filename: helpers/html_helper.php Line Number: 445 A PHP Error was encountered Severity: Warning Message: Invalid argument supplied for foreach() Filename: helpers/html_helper.php Line Number: 447 A PHP Error was encountered Severity: Notice Message: Undefined variable: li_a_menu Filename: helpers/html_helper.php Line Number: 450 Following is my code kindly help me if ( ! function_exists('menu')) { function menu($menu=''){ $id=$menu['id']; $item= $menu ['menu']; $nav_menu='<div id ='."$id".'>'; foreach($item as $li_menu){ $li_a_menu[]='< a href ='.base_url().$li_menu.'>'.strtoupper(str_replace('_','',$li_menu)).'</a>'; } $nav_menu.=ul($li_a_menu).'</div>'; echo $nav_menu; } } I created the View navigtion.php i am calling it like this $data= array('id'=>'nav', array ('menu1' =>'home', 'menu2' =>'create_post', 'menu3' =>'contact', 'menu4' =>'about'), ); echo menu($data); It throws error message kindly help me please read the error message at the start of this post
  2. My first language is not english so bear with my english. I want to make erd generatoor in PHP in this application user enter table name and its attriubutes and when user click on generate button it will make erd and also make releations between tables.System should make relations itself i have completed one phaze give table name and attibutes and click on generate erd button it draw table .Can any one tell me how to make relations functionality? if you know any tutorial similar to this site will be much appreciated . or just tell me the logic or instruction how to implement. Regards
  3. well i do not have family column on my table i have id, product _name, catagory, sub catagory,details,image, price these are my columns in my table ......and in the picture in simlar products catagory anything possible without add new column?
  4. hi My first language is not english so i hope you bear it i am new to php am am making my shopping Cart as my web engineering course i have made everything i all want to know how to i show similar products when a user click on any product details it open new page and shows a detail of that page i want to show similar products list below to details so can any tell me how to do it plzz kindly see the pic in atttachment i have posted snap shop of my page i put similar product statically i want to show it dynamically from tha data base kindly answer please regards [attachment deleted by admin]
  5. hi my first language is german my english is not good so kindly bear it i have uploaded my files on free server /hosting site when i run it it shows me my products now the problem i m facing is when i click on add to cart it generates me this this error or warning at the all above page it generates this error Warning: Cannot modify header information - headers already sent by (output started at /www/clanteam.com/a/z/e/azeempro/htdocs/cart/include/config.php:1) in /www/clanteam.com/a/z/e/azeempro/htdocs/cart/public/index.php on line 33 below it it add products in cart array Shopping Cart Array ( [2] => 1 ) 1 Items $90.00 checkout below that it gives this warning Warning: include() [function.include]: Unable to access /www/clanteam.com/a/z/e/azeempro/htdocs/cart/public/views/shop/add_to_cart.php in /www/clanteam.com/a/z/e/azeempro/htdocs/cart/public/views/layouts/shop.php on line 24 Warning: include(/www/clanteam.com/a/z/e/azeempro/htdocs/cart/public/views/shop/add_to_cart.php) [function.include]: failed to open stream: No such file or directory in /www/clanteam.com/a/z/e/azeempro/htdocs/cart/public/views/layouts/shop.php on line 24 Warning: include() [function.include]: Failed opening '/www/clanteam.com/a/z/e/azeempro/htdocs/cart/public/views/shop/add_to_cart.php' for inclusion (include_path='.:/usr/lib/php') in /www/clanteam.com/a/z/e/azeempro/htdocs/cart/public/views/layouts/shop.php on line 24 kindly help me i think there is path problem kindly solve this out please i will be thankful regards this is my index page <?php include('db_fns.php'); include("cart_functions.php"); if(!isset($_SESSION['cart'])) { //session_start(); //session_start($_SESSION['cart']); $_SESSION['cart']=array(); $_SESSION['total_items']=0; $_SESSION['total_price']=0.00; } $view=empty($_GET['view'])?'index':$_GET['view']; $controller='shop'; switch ($view){ case "index": $products = find_product(); break; case "add_to_cart": $id=$_GET['id']; $add_item=add_to_cart($id); $_SESSION['total_items']=total_items($_SESSION['cart']); $_SESSION['total_price']=total_price($_SESSION['cart']); header('Location: index.php'); break; case "update_cart": update_cart(); $_SESSION['total_items']=total_items($_SESSION['cart']); $_SESSION['total_price']=total_price($_SESSION['cart']); header('Location:index.php?view=checkout'); break; case "checkout": $shipping=0.00; if($_SESSION['total_price']<=100.00 || $_SESSION['total_price']<=200.00){ $shipping=$shipping + 30.00; }elseif($_SESSION['total_price']<=300.00 || $_SESSION['total_price']<=500.00){ $shipping=$shipping + 45.00; }elseif($_SESSION['total_price']<=600.00 || $_SESSION['total_price']<=1000.00){ $shipping=$shipping+ 70.00; }elseif($_SESSION['total_price']>1000.00){ $shipping=$shipping+ 100.00; }else{ $shipping=10.00; } break; } include ('/www/clanteam.com/a/z/e/azeempro/htdocs/cart/public/views/layouts/'.$controller.'.php'); ?> shop.php is <?php ?> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title> Shopping Cart</title> <link href="stylesheets/cool_style.css" media="screen" rel="Stylesheet" type="text/css" /> </head> <body> <h1> products</h1> <div class="cart"> <p><b> Shopping Cart</b></p> <p><?php print_r($_SESSION['cart']);?></p> <p><?php echo $_SESSION['total_items'];?> Items </p> <p>$<?php echo number_format($_SESSION['total_price'],2);?></p> <p><a href="index.php?view=checkout">checkout</a></p> </div> <hr/> <?php include('/www/clanteam.com/a/z/e/azeempro/htdocs/cart/public/views/'.$controller.'/'.$view.'.php');?> </body> </html>
  6. hi im new to php i am making shopping cart i made a session variable to add products in cart when i run it gives this warning Notice: Undefined index: cart in C:\wamp\www\cart\public\views\layouts\shop.php on line 15 Notice: Undefined index: total_items in C:\wamp\www\cart\public\views\layouts\shop.php on line 16 Notice: Undefined index: total_price in C:\wamp\www\cart\public\views\layouts\shop.php on line 17 but when i click on add to cart it add product price and quanitity kindly help me my shop.php code is <head> <title> Shopping Cart</title> <link href="stylesheets/cool_style.css" media="screen" rel="Stylesheet" type="text/css" /> </head> <body> <h1> products</h1> <div class="cart"> <p><b> Shopping Cart</b></p> print_r($_SESSION['cart']); echo $_SESSION['total_items']; echo number_format($_SESSION['total_price'],2); </div> <hr /> </body> </html> and my index file is where i set session variables are include('db_fns.php'); include("cart_functions.php"); session_start(); if(isset($_SEESION['cart'])) // if change this conditon if(!isset($_SEESION['cart'])) it gives not warning but does not //add products to the cart it does not do anything { $_SESSION['cart']=array(); $_SESSION['total_items']=0; $_SESSION['total_price']=0.00; } $view=empty($_GET['view'])?'index':$_GET['view']; $controller='shop'; switch ($view){ case "index"; $products = find_product(); break; case "add_to_cart"; $id=$_GET['id']; $add_item=add_to_cart($id); $_SESSION['total_items']=total_items($_SESSION['cart']); $_SESSION['total_price']=total_price($_SESSION['cart']); header('Location: index.php'); break; case "update_cart"; break; case "checkout"; break; } if change this conditon if(!isset($_SEESION['cart'])) it gives not warning file run correctly with no warning but does not add products to the cart and does not do anything kindly help me please
  7. thsese are my functions public function update(){ global $db; $sql= "UPDATE user SET "; $sql.= "username='". $db->mysql_prep($this->username) ."', "; $sql.= "password='". $db->mysql_prep($this->password) ."', "; $sql.= "firstname='".$db->mysql_prep($this->firstname) ."', "; $sql.= "lastname='". $db->mysql_prep($this->lastname) ."' "; $sql.= "WHERE id=". $db->mysql_prep($this->id); $db->query($sql); return ($db->affected_rows()==1)?true:false; query function used in update function is public function query($sql){ $this->last_query= $sql; $result= mysql_query($sql,$this->connection); $this->confirm_query($result); return $result; confirm query function used in query is private function confirm_query($result){ if(!$result){ $output = "Database Query Failed: ". mysql_error()."<br/><br/>"; $output.= "Last Query: ". $this->last_query; die($output); } } error i got is Database Query Failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 Last Query: UPDATE user SET username='', password='jimmy', firstname='', lastname='pakistan' WHERE id=
  8. i have echo query it shows this result Database Query Failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 Last Query: UPDATE user SET username='', password='jimmy', firstname='', lastname='pakistan' WHERE id=
  9. yeh i have echo its in query function $db->query() function takes sql command and run it n show result i guess there is problem in update statement
  10. im getting error when i run the page Database Query Failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 my query is public function update(){ global $db; $sql= "UPDATE user SET "; $sql.= "username='". $db->mysql_prep($this->username) ."', "; $sql.= "password='". $db->mysql_prep($this->password) ."', "; $sql.= "firstname='".$db->mysql_prep($this->firstname) ."', "; $sql.= "lastname='". $db->mysql_prep($this->lastname) ."' "; $sql.= "WHERE id=". $db->mysql_prep($this->id); $db->query($sql); return ($db->affected_rows()==1)?true:false;
  11. i have made function of prepare or check the mysql real escapte string but when i run this code it gives two warnings msg Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'SYSTEM'@'localhost' (using password: NO) in C:\wamp\www\cart\include\db.php on line 42 Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in C:\wamp\www\cart\include\db.php on line 42 kindly tell me what is this msg about how to solve it my code is 37 public function mysql_prep($value){ 38 $magic_quotes_active=get_magic_quotes_gpc(); 39v$new_enough_php=function_exists("mysql_real_escape_string"); 40 if($new_enough_php){ 41if($magic_quotes_active){ $value=stripslashes($value);} 42 $value= mysql_real_escape_string($value);} 43 else { 44 if($magic_quotes_active){$value=addslashes($value);} 45} 46 return $value; 48 }
×
×
  • 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.