812 Posted Topics

Member Avatar for diether.silverious

Provided that $result has one element less than $productItems: foreach($productItems as $key => $item) { if(isset($result[$key])) { $productItems[$key]['price'] = $result[$key]; } }

Member Avatar for broj1
0
110
Member Avatar for kingkong142

Code for the last button: <div class="buyOrSellBox"> <input id="memberRoleIntlBoth" value="both" onclick="document.getElementById('userrole-error').style.display='none';changesubmitbtnname('yes');" name="userrole" style="border: 0px none ;" type="radio" <? // the condition is: // if $_REQUEST['userrole'] is not set (none of the radio buttons have been chosen) // or the 'both' radio button has been chosen // then make it checked …

Member Avatar for kingkong142
0
162
Member Avatar for davy_yg

A few notes here: 1. You mix GET and POST method. From URL it seems like your intention is to use GET, from the code it seems like you wanted to use POST; it is nothing wrong with mixing methods but do not do it if not realy needed since …

Member Avatar for broj1
0
166
Member Avatar for diether.silverious

First start the table and add a header row: <table > <tr><th>Product ID</th><th>Items</th><th>Price</th><th>Date</th><th>Action</th></tr> Then add the rows with data: <?php while($row = mysql_fetch_array($sql)){ $id = $row["id"]; $product_name = $row["name"]; $details = $row["details"]; $size = $row["size"]; $price = $row["price"]; $quantity = $row["quantity"]; $date_added = strftime("%b %d, %Y", strtotime($row["date_added"])); echo "<tr>"; echo …

Member Avatar for diether.silverious
0
200
Member Avatar for nevek

Escape the values in the query using your databases's escape function. If you use mysqli the function is [mysqli_real_escape_string](http://php.net/manual/en/mysqli.real-escape-string.php) (or mysqli::real_escape_string if you do it OOP way). $query = "UPDATE room SET floor='" . mysql_real_escape_string($room->floor) . "' where id=room->id";

Member Avatar for broj1
0
196
Member Avatar for janskey15

Insert a temporary debug code. It is simple but it often helps. Test the displayed query in phpmyadmin or post it here. <?php include "dbConfig.php"; $Y=$_POST["Y"]; $query="INSERT into tbl_subjectsenrolled (SubjectID) values ('".mysql_rel_escape_string($Y)."')"; // Temp DEBUG code die($query); mysql_query($query) or die (mysql_error()); ?>

Member Avatar for janskey15
0
230
Member Avatar for dados

You need to use client side (which is most often javascript) to detect screen size. Have a look at this link: http://www.javascriptkit.com/howto/newtech3.shtml How to utilize that with php? Maybe using Ajax, something like this (I use jquery [load](http://api.jquery.com/load/) here): <script type="text/javascript"> // URL to open var myUrl = ''; // …

Member Avatar for IIM
0
897
Member Avatar for Rizi004

Looking at source of your page two errors show up in Firefox on Ubuntu: - the comment line `<!----Car Image -->` is not structured correctly (my FF says *-- is not permitted withim a comment*) - it also doesn't like the line `<div class="ui-widget">`. It is probably not allowed there …

Member Avatar for broj1
0
84
Member Avatar for fheppell

The [mysql_query](http://php.net/manual/en/function.mysql-query.php) function returns a resource not a row. The resource is a special php type that can be used to retrieve rows. You can use the mysql_fetch_row() function to fetch rows while ($row = mysql_fetch_assoc($cat_name)) { echo $row['cat_title']; } Please note that $cat_name is a misleading name for a …

Member Avatar for fheppell
0
3K
Member Avatar for davy_yg

On line 15 more appropriate check would be: if (isset($_POST['id']) && is_int($_POST['id'])){ so you are checking whether $_POST['id'] exists at al and is integer.

Member Avatar for broj1
0
177
Member Avatar for ahmedhamdy

You should pass your getLink function connection parameters since it can not access variables out of it's scope: function getLink($serverName,,$userName,$userPassword,$nameOfDataBase){ $link=@mysqli_connect($serverName,$userName,$userPassword,$nameOfDataBase); if(!$link){ echo "connection Error".mysqli_connect_errno(); } return $link; }

Member Avatar for diafol
0
7K
Member Avatar for asaidi

It is hard to figure out from your post what exactly is the problem but looking at your query on line 6 this certainly won't work: if ($ser<4) $sql .= " AND pulse_channel=$serv[] "; You can't use $serv[] a query (which is basicaly a string). You will either have to …

Member Avatar for LastMitch
0
122
Member Avatar for Atlanta15Braves

Also there are tags missing like `<form>`, closing `</td>` and `</tr>` and `<table> </table>` pair. But main error is as *pixelsoul* pointed the missing curly bracket.

Member Avatar for pixelsoul
0
537
Member Avatar for thrillride01

[phpacademy](https://phpacademy.org/) if you prefer watching videos. You will also find tutorial for mysql there. PHP comes to it's power if you dynamicaly use data from a database (and mysql is most often used).

Member Avatar for pritaeas
0
271
Member Avatar for atikah8890

Where do you get the list of questions to be displayed? In any case it is probably an array of question ID's which you have to iterate through. // array of question IDs to be displayed // I just made them up for this example $q_id_arr = array(1,2,3,4,5); // loop …

Member Avatar for broj1
0
460
Member Avatar for PixelatedKarma

I think it's got to do with the fact that Joomla is written following the MVC pattern. All the processing and database access is done somewhere behind (model / controller) and the result is displayed thorugh single index.php page (affected also by a template). On their site they say: Joomla! …

Member Avatar for broj1
1
1K
Member Avatar for icehiro

On line 8 you should probaly have a space before WHERE $query_update .= " WHERE `item_id`=".$_POST["item_id"]; and the comma on line 7 should not be there (before the WHERE): $query_update .= "`item_avai`='".$_POST["item.avai"]."'"; The easiest way to check is to insert a debug code between lines 8 and 9: die($query_update); which …

Member Avatar for IIM
0
145
Member Avatar for jim.booth.5209

Can you clarify this: you have a table C_Search containing a set of keywords. Do you want to search by all of them or just a few of them?

Member Avatar for broj1
0
242
Member Avatar for jhilmil123

You basically need another ajax call passing values to a php script that will insert/update database.

Member Avatar for broj1
0
349
Member Avatar for mjsmitten

The first while loop has no code since you did not use any curly brackets. Is this suppose to be like that? Or would be more correct like this: while (osc_has_categories ()) { // check category id and name inside while loop is ok! echo osc_category_id(), ": ", osc_category_name() ; …

Member Avatar for mjsmitten
0
272
Member Avatar for abhi10kumar

I assume the `/home/delhioia/public_html/facebook/index.php` file is being included from `/home/delhioia/public_html/index.php`, right? The error message says that `/home/delhioia/public_html/index.php` is sending output on line 7, probably before inclusion of the `/home/delhioia/public_html/facebook/index.php` that is why the error, I presume (provided that my assumptions are right).

Member Avatar for broj1
0
157
Member Avatar for Szabi Zsoldos

Do the values come from the $nume_produs[1] and $key variables? Where do they get assigned and what from?

Member Avatar for broj1
0
223
Member Avatar for techyworld

1. It assigns a value to $username variable, using EscapeCharacters() method of a $secure object (it is an example of object oriented PHP) to escape characters. $secure is an object derived from some class that is obviously designed to deal with user (form) input at login. There must be an …

Member Avatar for IIM
0
175
Member Avatar for Don Ocso

<?php // you have your subject $subject = ...; do it in php: // echo this in appropriate place in html (betwen <head> and </head> tags) echo '<meta name="description" content="' . $subject . '">'; echo '<title>' . $subject . '</title>'; ?> or in html: <meta name="description" content="<?php echo $subject; ?>"> …

Member Avatar for Don Ocso
0
133
Member Avatar for lewashby
Member Avatar for broj1
0
154
Member Avatar for lotpb

Just one question: why do you store the $_POST array in session? What is the exact purpose of that? Tipically the code goes like that: - you have a form wrapped within <form> and </form> tags (you do not have that, any reason why not?) - in the opennig <form> …

Member Avatar for broj1
0
484
Member Avatar for rubai

You can save values in a txt file, JSON format would be a good one. You can use [json_encode](http://php.net/manual/en/function.json-encode.php) and [json_decode](http://www.php.net/manual/en/function.json-decode.php) functions. Instead of JSON you can just serialize data into a txt file.

Member Avatar for rubai
0
2K
Member Avatar for jLamp

And an excellent resource for web apps security is OWASP and their [Top 10 cheat sheet](https://www.owasp.org/index.php/OWASP_Top_Ten_Cheat_Sheet). Go through their list.

Member Avatar for jLamp
0
156
Member Avatar for ahudson

Maybe not the most elegant solution but it works. <?php // connect to DB ... // run an endless loop while(1) { // generate unique random number $randomNumber = rand(0, 999999999); // check if it exists in database $query = "SELECT * FROM tbl_rand WHERE the_number=$randomNumber"; $res = mysql_query($query); $rowCount …

Member Avatar for diafol
0
3K
Member Avatar for liphoso

Why do you store contents in database? You could just save a file in a directory and let users downolad it from there. If it is really necessary to store the contents in database I think the field type should be binary. I am not sure if you can recreate …

Member Avatar for IIM
0
150
Member Avatar for ngonix

Another way of doing it: Frst initialize the variables to empty string: $search_policy = ''; $search_surname = ''; $search_name = ''; Then you assign a condition to any of the variables if $_POST element exists, as you have done it. On lines 43 to 45 chremove the else bit from: …

Member Avatar for broj1
0
1K
Member Avatar for Prov1

And also post a few sample rows of csv file, especially the ones that cause problems.

Member Avatar for broj1
0
97
Member Avatar for GlenRogers

The form does not have to be loaded from a separate php file. It can be in a div that is initially hidden (say the id is form-container) and when the user clicks the *Add News Item* link the div is shown using jquery [show()](http://api.jquery.com/show/) method. $(document).ready(function(){ $("#news").click(function(){ $("#form-container").show(); }); …

Member Avatar for broj1
0
256
Member Avatar for asaidi

Display the queries and check them in phpmyadmin (and post here if you do not find an error). Insert this code after line 46 but before the closing curly bracket: echo "SQL: $sql<br>SQL1: $sql1<br>SQL2: $sql2<br>SQL3: $sql3<br>SQL4: $sql4";

Member Avatar for broj1
0
146
Member Avatar for matanc244

On line 14 ('$_POST[title]',''$_POST[discription]','$_POST[content]')"; you have two single quotes so the query syntax is wrong. Remove one of them. Edit: haven't noticed that LastMitch has already pointed that out, sory.

Member Avatar for broj1
0
92
Member Avatar for hunterious.latham

Looks like the `else` statement on line 54 hasn't got a closing curly bracket. I you put one say on line 73 the error is gone. Double check though if that is the intended place for it.

Member Avatar for broj1
0
473
Member Avatar for Angel78

You can create radio buttons with PHP. Put categories in an array, cycle through it, add code for radio buttons and check if current category matches the one from the DB: <?php // array of categories (you can always edit it and the radio buttons will change) $categoriesArr = array('Action', …

Member Avatar for broj1
0
259
Member Avatar for sgnark

The trouble is in your first line: // index.php <?php session_start(); ob_start(); ?> You use php comment outside of `<?php ?>` block so it is not treated as php code but as html code. That means that you send html before calling session_start() and ob_start() which is incorrect since both …

Member Avatar for broj1
0
3K
Member Avatar for OsaMasw

Each input on your form has to have a unique ID so you can refer to it. Also edit links have to have uinque IDs. You can use an ID from the database data or something else. <input name="tx_name" type="text" id="tx_id-<? echo $data['id']; ?>" size="35" value="<? echo $data['title']; ?>"/> <a …

Member Avatar for OsaMasw
0
209
Member Avatar for kiLLer.zoh_1

Let me repeat to see if I understood: You want to generate unique keys yourself (IOW mysql autoincrement is not OK for your purpose). What is the format of the key and what are the rules for constructing the key? > then the new one created key must be from …

Member Avatar for broj1
0
115
Member Avatar for CreatorZeus

On line 5 you are assigning the same value to $result over and over again. $result = mysql_query("SELECT * FROM tag WHERE point='$pagename'"); so `while($row = mysql_fetch_array($result))` condition is always true (it is always first row of the table). I would remove line 5. The $result on line 9n is …

Member Avatar for IIM
0
191
Member Avatar for wuzere.crewzz

$query = "SELECT SUM(quanitity) FROM `tablename` GROUP BY `year`"; Backquotes might also be important if you use names that are same as mysql keywords.

Member Avatar for IIM
0
169
Member Avatar for dinhunzvi

You are returning only the name in a message not alsoo the lastname. Add lastname also and separate the name and lastname so you can distinguish them when returned from ajax cal, maybe with comma: ... while($nt=mysql_fetch_array($t)) { error_reporting(0); $msg.= $nt[name] . ',' . $nt[lastname]; } } echo $msg; On …

Member Avatar for broj1
0
1K
Member Avatar for daniel36

Are you sure the second and third SELECT keywords have to be there. Would this be OK: $bquery="SELECT * FROM rt_booking WHERE rt_unit_id='".$_POST['unit_id']."' AND (UNIX_TIMESTAMP(str_to_date(rt_start_date,'%Y-%m-%d'))>=".$my11." OR UNIX_TIMESTAMP(str_to_date(rt_end_date,'%Y-%m-%d'))<=".$my22.")";

Member Avatar for daniel36
0
141
Member Avatar for CreatorZeus

Put this temporary debug code on line 3: die("UPDATE $title SET arole = CONCAT_WS(',', arole, '$name') WHERE op = '$name'";); Your query will get displayed with actual values. Copy it to the SQL window of phpmyadmin and see what you get when you run it. If there are errors you …

Member Avatar for broj1
0
167
Member Avatar for Dani

I quickly put together this recursion function. function assoc2indexedMulti($arr) { // initialize destination indexed array $indArr = array(); // loop through source foreach($arr as $val) { // if the element is array call the recursion if(is_array($val)) { $indArr[] = assoc2indexedMulti($val); // else add the value to destination array } else …

Member Avatar for Dani
0
5K
Member Avatar for luke.belleghem

Check for existence of image in the DB table and if exists asign it to $logo variable otherwise assign a placeholder to $logo variable. Then display whatever is in the $logo. <?php if(isset($row_getListing['image'])) { $logo = $row_getListing['image']; } else { $logo = 'placeholder.jpg'; } ?> <div id="logo"><img src="images/<?php echo $logo; …

Member Avatar for Webville312
0
1K
Member Avatar for pucivogel

Put this code immediately after line 68: die("INSERT INTO file_records (file_name, file_title, file_size, uploaded_date) VALUES ('$NewFileName', '$FileTitle',$FileSize,'$uploaded_date')"); It will display the query as it gets contructed using the variables. Paste it into phpmyadmin and check for errors. You can also post it here. BTW: none of the data in the …

Member Avatar for broj1
0
410
Member Avatar for masocha

I have actually used PEAR a lot but it was on Linux machine. The Windows part of installation instruction is http://pear.php.net/manual/en/installation.getting.php . I had no problems installing it and using it in Linux nd I think it should work equally fine in windows. BTW if you are just after one …

Member Avatar for broj1
0
190
Member Avatar for metjan.baduni

It seems like there are no fields with those names in the pedagogu table. Can you check whether you have spelled the index names correctly and same as field names (sorry to bother you with one more check but nothing else seems to be incorrect). You can also try to …

Member Avatar for broj1
0
315

The End.