-
Posts
426 -
Joined
-
Last visited
Everything posted by lingo5
-
Hi Jessica, I'm just trying to get rid of a php error ...by doing this the error is gone. I know this is not a solution but it will do for today until the new site I'm doing for this client is finished. I didn't do this site and have no idea what the previous designer was doing...so I don't really have the time to go through the whole thing especially when the new site will be uptomorrow morning. so....I don't really know what I did but seemed to do the trick...that's all I need now. Sorry if I have given you a near heart attack.
-
Thanks all !! this seems to work ....and will have to do for now. function PrepararCadena($st) { $sRet = str_replace ("'/", "''", $st); $sRet = str_replace ('"/', '"', $sRet); $sRet = str_replace("'", "'/", $sRet); return $sRet; }
-
Hi cyber Robot, this is the code for the prepararCadena() function should I use preg_replace? function PrepararCadena($st) { $sRet = str_replace ("\\\'", "''", $st); $sRet = str_replace ('\\\\\"', '"', $sRet); $sRet = str_replace("'", "\'", $sRet); return $sRet; }
-
Hi, this is a piece of old code used to update a MySQL db (not done by me). It has been working now on a client's site till today, when the text inserted doesn't admit apostrophes !!!!. I know is something to do with mysql_real_escape_string....but don't know how to modify the code..please help !!..... //---- update text $sValors= ""; for ($i=0; $i<count($aCampos); $i++){ switch($aTipoCampo[$i]){ case "string" : $sValors .=$aCampos[$i]."='".prepararCadena(${$aCampos[$i]})."',";break; case "num" : $sValors .=$aCampos[$i]."=".PrepararDecimales((float)nz(${$aCampos[$i]},0)).","; break; case "boolean" : $sValors .=$aCampos[$i]."=".nz(${$aCampos[$i]},"0").","; break; } } $sValors=removeSufix($sValors,","); $sSQL="update t_textos ". "set $sValors ". "where id_texto=$id"; textedebug( $sSQL); dat_execMant($sSQL); redirect($sUrlLista); }
-
wow christian thanks for that explanation. I finally got it working by using JOIN in my query. Thanks again
-
Barand I've done it !!!!!!!! thanks for your help...this is how I did it $colname_premios_RS = "-1"; if (isset($_POST['cupon_numero'])) { $colname_premios_RS = $_POST['cupon_numero']; } mysql_select_db($database_MySQLconnect, $MySQLconnect); $query_premios_RS = "SELECT * FROM t_cupones LEFT JOIN t_premios ON (t_cupones.id_premio = t_premios.id_premio) WHERE cupon_numero = $colname_premios_RS"; $premios_RS = mysql_query($query_premios_RS, $MySQLconnect) or die(mysql_error()); $row_premios_RS = mysql_fetch_assoc($premios_RS); $totalRows_premios_RS = mysql_num_rows($premios_RS);
-
Why do i get "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" when using this query? $colname_cupon_RS = "-1"; if (isset($_POST['cupon_numero'])) { $colname_cupon_RS = $_POST['cupon_numero']; } mysql_select_db($database_MySQLconnect, $MySQLconnect); $query_cupon_RS = sprintf("SELECT * FROM t_cupones WHERE cupon_numero = %s", GetSQLValueString($colname_cupon_RS, "text")); $cupon_RS = mysql_query($query_cupon_RS, $MySQLconnect) or die(mysql_error()); $row_cupon_RS = mysql_fetch_assoc($cupon_RS); $totalRows_cupon_RS = mysql_num_rows($cupon_RS; $id_premio=$row_cupon_RS['id_premio']; // i use this to get id_premio mysql_select_db($database_MySQLconnect, $MySQLconnect); $query_premio_RS = "SELECT * FROM t_premios WHERE id_premio =$id_premio "; $premio_RS = mysql_query($query_premio_RS, $MySQLconnect) or die(mysql_error()); $row_premio_RS = mysql_fetch_assoc($premio_RS); $totalRows_premio_RS = mysql_num_rows($premio_RS); it works fine when the enteredcoupon number exists....but throws the error when the numbre doesn't exist. please help...i'm reall confused now....thanksss
-
ok, i have tried this to get the premio_descripcion_esp from the table t_premios based on the id_premio from t_cupones....what am I doing wrong? mysql_select_db($database_MySQLconnect, $MySQLconnect); $query_premios_RS = "SELECT * FROM t_cupones LEFT JOIN t_premios ON t_cupones.id_premio = t_premios.id_premio"; $premios_RS = mysql_query($query_premios_RS, $MySQLconnect) or die(mysql_error()); $row_premios_RS = mysql_fetch_assoc($premios_RS); $totalRows_premios_RS = mysql_num_rows($premios_RS);
-
thanks barand, i have now stored the cupon_numero value in a session like so: <?php session_start(); $_SESSION['cupon_numero'] = $_POST['cupon_numero']; ?> i then get he value passed to the next page to show the result for this query: $colname_texts_RS = "-1"; if (isset($_SESSION['cupon_numero'])) { $colname_texts_RS = $_SESSION['cupon_numero']; } mysql_select_db($database_MySQLconnect, $MySQLconnect); $query_texts_RS = sprintf("SELECT * FROM t_cupones WHERE cupon_numero = %s", GetSQLValueString($colname_texts_RS, "text")); $texts_RS = mysql_query($query_texts_RS, $MySQLconnect) or die(mysql_error()); $row_texts_RS = mysql_fetch_assoc($texts_RS); $totalRows_texts_RS = mysql_num_rows($texts_RS); this works fine when the cupon_numero entered exists on my db...but shows the mentioned syntax error when the entered cupon_numero doesn't exist on the db. I store coupon information on one table (t_cupones) and prize information on another (t_premios). t_cupones stores the prize_id ad t_premios contains the actual prize. Using the query above I'm able to get the prize id of a given coupon, but what I need is to also query t_premios to get the actual prize description based on the prize_id resulting from the irst query. Sorry...I don't know if this makes sense?
-
Hi I have a form that posts a 10 digit number to create a db query like so (sorry about spanish words but that's my mothertongue:-): <form id="form1" name="form1" method="post" action="../miregalo.php"> <input name="cupon_numero" type="text" class="premioField" id="cupon_numero" maxlength="10" /> <input type="submit" value="DALE !!" /> </form> and this is the query i create to show results for that number: $colname_texts_RS = "-1"; if (isset($_POST['cupon_numero'])) { $colname_texts_RS = $_POST['cupon_numero']; } mysql_select_db($database_MySQLconnect, $MySQLconnect); $query_texts_RS = sprintf("SELECT * FROM t_cupones WHERE cupon_numero = %s", GetSQLValueString($colname_texts_RS, "text")); $texts_RS = mysql_query($query_texts_RS, $MySQLconnect) or die(mysql_error()); $row_texts_RS = mysql_fetch_assoc($texts_RS); $totalRows_texts_RS = mysql_num_rows($texts_RS); this works fine except for one thing....if i enter a coupon numbre that is not on the db i get a syntax error like this: 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 and hat I would like to be able to do is to get a custom message if the coupo numbre posted by the form does not exist on my db....am I being silly and unable to see a simple solution here?....
-
Thanks Chrsitian F....doing some research on the nr. 2 method now.
-
Hi, I am back to this project now after a few weeks of exams. Is it possible to insert php code within js?....the thing is I need to insert a dynamic select to display the products in my DB in the table div like so // Create the div (new row) and add its elementsvar div = $(document.createElement("div")).html('<table width="901" align="center"><tr class="prototype"><form name="form" ><td bgcolor="#F8F8F8"<input var var div = $(document.createElement("div")).html('<table width="890" border="0" align="center" cellpadding="5" cellspacing="1"><tr><td width="57" align="center" bgcolor="#CCCCCC"><input type="text" class="id" size="3" readonly="readonly" /></td><td width="385" align="center" bgcolor="#CCCCCC" class="headerTXT"><select name="producto" id="producto"></select></td><td width="82" align="center" bgcolor="#CCCCCC" class="headerTXT"><input type="text" class="num" style="width: 30px;" value="0"/></td><td width="74" align="center" bgcolor="#CCCCCC" class="headerTXT"><input type="text" class="num" style="width: 50px;" value="0"/> <span class="blackTXT">\u20AC </span></td><td width="72" align="center" bgcolor="#CCCCCC" class="headerTXT"><span class="blackTXT">21%</span></td><td width="80" align="center" bgcolor="#CCCCCC" class="headerTXT"><span id="result"></span> <span class="blackTXT"><span class="result">0</span> €</span></td><td width="70" align="center" bgcolor="#CCCCCC"><input type="button" style="width:70px;height:25px" class="remove" value="Remove" /></td></tr></table>'); How would I call the connection and insert the php code in the js script? TY
-
thanks cluel3ss, I'm still working on the .htaccess part
-
thanks jazzman...I'm doing some research on how to hide php extension in url string....so far I got the first part working !!!!
-
Thanks everyone and sorry..my mistake...had a typo somewhere !!!! THANKS ALL
-
ah ok..yes it starts with period..but I can't get the above rules to work....
-
hi jazzman..how do I do that?
-
nope....
-
thanks beeeeney...but nope...it doesn't work
-
Hi, I want all my php urls like products.php to show up as /products....so I have created a htaccess file with the following rule: Options +FollowSymlinks RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule ^(.*)$ $1.php [NC,L] ...but I does not work and I still get the url with the php extension....any help very much appreciated. thanks
-
Thank you both !!!...it works now !!!! .... :happy-04: :happy-04: Muddy_Funster I love you
-
hi, I have a table called "products" where i store product info including id_family. I have another table called "families" where I store the family_name and id_family. This is how I get all my products from the DB: mysql_select_db($database_MySQLconnect, $MySQLconnect); $query_products_RS = "SELECT * FROM t_products ORDER BY product_titulo_esp ASC"; $query_limit_products_RS = sprintf("%s LIMIT %d, %d", $query_products_RS, $startRow_products_RS, $maxRows_products_RS); $productsRS = mysql_query($query_limit_productsRS, $MySQLconnect) or die(mysql_error()); $row_products_RS = mysql_fetch_assoc($products_RS); ...this works fine. Whay i need to do now is to get the family_name from the table "families" for each product based on the id_family column from the "products" table..... do I make sense?....thanks!!
-
thanks anyways Christian.....
-
thankssssssssssssssss......... http://www.redbook.es/facturator/test2.php
-
sorry, this is the html for the resulting calculation <span id="result"></span> <span class="blackTXT"><span class="result"></span> €</span> and this is the js // Show totaldiv.find(".result").html(total);}); how do I show 0 by default?