812 Posted Topics

Member Avatar for seemeamal

You must be getting some error message somewhere. What does it say? It is a good idea to check for existence of all $_POST array elements before using them since some of them might not exist which breaks your query. Something like: [CODE]if(isset($_POST["dept_name"])) { $dept_name=$_POST["dept_name"]; } else { echo 'You …

Member Avatar for GliderPilot
0
123
Member Avatar for bflack

I think the problem is you are using $column for internal variables in your function. Change them to unique names like: [CODE]function vote($column, $imgid) { $query="SELECT $column FROM images WHERE imgid=$imgid"; $result=mysql_query($query); if($row=mysql_fetch_assoc($result)) { $value=$row[$column]; $value += 1; // or $value++ which is the same } // add this check …

Member Avatar for scaiferw
0
131
Member Avatar for zack654

I use PEAR Pager class: [url]http://pear.php.net/package/Pager/[/url] with help of the Pager_Wrapper class for paginating data read from a database: [url]http://www.alberton.info/pear_pager_tutorial_database_results.html[/url] Maybe a bit old stuff but it works great. At least you can have look at the code.

Member Avatar for subrata_ushasi
0
241
Member Avatar for afaaro

I do not understand one thing. Why are you passing parameters $catname and $catdesc if you do not use them but instead immediatelly assign some values to them? This is unusual. And check the values of $ok which you are passing and and $save since the update part depends on …

Member Avatar for broj1
0
119
Member Avatar for jayhall

SQL gurus would make up a query that would spit out the rows in correct order but I propose a solution with a simple query and PHP then sorting out the results so it shows what you want. See the comments in code. Please note all error checking is omitted …

Member Avatar for diafol
0
662
Member Avatar for filipgothic

So you want to select a city at the end of the form and see the statistics for that city (please note: on english version the select element for cities at the end is missing)? Do you want to see results on the same page or on different page (your …

Member Avatar for filipgothic
0
425
Member Avatar for adityamadhira

Your code is almost OK. I only added <select> and </select> tags on the beginning and end of the while loop and double quotes around $id (and changed $did in your code to $id). [CODE]$data = @mysql_query("select * from Department"); $array = array(); echo '<select>'; while ($row = mysql_fetch_assoc($data)) { …

Member Avatar for vaultdweller123
0
162
Member Avatar for lastgame2007

Not sure if this is what solves your problem but anyway: for padding numbers you can use PHP str_pad() function. [url]http://php.net/manual/en/function.str-pad.php[/url]

Member Avatar for diafol
0
247
Member Avatar for fika

Current local date and time: [url]http://php.net/manual/en/function.date.php[/url] Note that since PHP 5.1 you have to set timezone for local time either in a format string or by calling date_default_timezone_set() function or by setting it in PHP ini. [url]http://php.net/manual/en/function.date-default-timezone-set.php[/url] [url]http://www.php.net/manual/en/datetime.configuration.php#ini.date.timezone[/url] To store a date in mysql table you can use the mysql …

Member Avatar for diafol
0
197
Member Avatar for yanwick

Works fine on my system: Fedora 15, Firefox 9, Apache 2.x on localhost. I think it should run on other systems too. What error do you get?. If you look at the page source in the browser is there anything displayed? What do you get if you add some text …

Member Avatar for yanwick
0
234
Member Avatar for adityamadhira

Also set action attribute to '#' so the form gets submitted to itself. [CODE]<form action= "#" method="post">[/CODE]. And yes, select element should be between [iCODE]<form>[/iCODE] and [iCODE]</form>[/iCODE] tags.

Member Avatar for cigoL..:)
0
303
Member Avatar for clc_services

Hope you are still interested in help for this :-). First wrap your select element in form tags and set method (GET) and action (# -> self). Then add a submit button so the form can be submitted (or make the select element autosubmit). [CODE]// add <form> tags and a …

Member Avatar for clc_services
0
2K
Member Avatar for liphoso

First thing: escape double quotes in line 44: [CODE]echo "<img src=\"logo.jpg\" width=\"50\" height=\"50\">";[/CODE] Lines 14 to 18 should go after the if on line 57. When you check whether the form was submited and if it was you can read POST variables and then you will be using the correct …

Member Avatar for broj1
0
121
Member Avatar for baig772

One way of doing it is create a background image for watermark (i.e. light colored text on a transparent background) say watermark.png and then use css to put this watermark image as a div background with the following css code [CODE].watermarked-div {background-image:url('watermark.png');background-repeat:repeat;} [/CODE] This will repeat your watermark across any …

Member Avatar for salumerzi4
0
124
Member Avatar for ARKaMAN

And also check if each element of the $_POST array is actually set with isset(). Maybe $_POST['edate'] has not been set.

Member Avatar for diafol
0
136
Member Avatar for microbert

First, you are missing double quotes for html attributes. I put them in the code below and they are escaped when also using double quotes as a string delimiter. Since you provided only two fields as a result from your query I prepared a code for a table with two …

Member Avatar for broj1
0
4K
Member Avatar for tibormarias

The closing curly bracket } on line 28 should actually be just after line 24 (at the end of the function dbQuery). These things are quite easy to spot if you use indentation and editor with syntax highlighting. [CODE]<?php session_start(); function __autoload($name) { require $name . '.php'; } function dbInit(){ …

Member Avatar for broj1
0
181
Member Avatar for rapidwein

You are missing a ?> tag on line 30 (if you used CODE tags, the lines would be numbered :-). So line 30 should be [CODE]<script type="text/javascript" src="logger.php?t=<?php echo time(); ?>&f=<?php echo $_SERVER['REQUEST_URI']; ?>&r=<?php echo urlencode($_SERVER['REQUEST_URL']);?>"></script>[/CODE] or something similar.

Member Avatar for broj1
0
227
Member Avatar for anthonyjpv

mysql commands are within php script and not in the plain html so it is safe to have them in the same script as the form. The commands are not (should not be) exposed to the browser.

Member Avatar for broj1
0
87
Member Avatar for PF2G

The line [iCODE]$query_prog = mysql_query($sql_prog, $connect);[/iCODE] returns false instead of a valid resource (and stores it in $query). The reason could be error in your sql statement ($sql) or error in your connection ($connect). You should check for existence of a valid resource before running a while loop: [CODE]if($query_prog) { …

Member Avatar for broj1
0
125
Member Avatar for shielaolid

You are initializing the $error variable to an empty string just before checking whether it contains anything. Initialize it on the beginning of the script and do the check after the checking for correct password. Also session_register function is deprecated. I recommend you avoid it. Use direct assignment instead: [CODE]$_SESSION['myusername'] …

Member Avatar for broj1
0
71
Member Avatar for Martin C++

A few notes about how you code the form: 1. form action attribute should point to a page (either html or php or # - self). In your example it does not point to a valid url 2. select element should have a name not the option elements so [iCODE]<select …

Member Avatar for broj1
0
482
Member Avatar for evilguyme

Well, you can do it in two ways. The old fashioned way is using a table to position pictures and data. Say you have two columns and each cell in column 1 has rowspan attribute set to 3 (or whatever the number of data cells is). [CODE]$tbl = '<table border="1"><tr>'; …

Member Avatar for broj1
0
114
Member Avatar for Danny159

I have been using OOP approach with PHP fo a couple of years now developing an app that runs mainly on intranet and occasionaly on internet. My opininon is that OOP approach makes code much more maintainable and reusable (extendable). However you need some practice to be able to design …

Member Avatar for diafol
0
218
Member Avatar for abelingaw

You should escape the double quotes in line 4: [CODE]echo"<script language=\"javascript\">window.alert('Invalid password.')...[/CODE]

Member Avatar for asprin
0
185
Member Avatar for jacob21

You can echo the HTML code only if there are any records pulled from the db. [CODE]if($records_exist) { echo '<a href="some_link">Click here</a>'; }[/CODE] If you want to change visibility locally (when script's HTML has been already downloaded) you will have to use javascript's getElementById() function to get the anchor element …

Member Avatar for broj1
0
137
Member Avatar for asif49

Recursion seems to be the best choice. [CODE]function getTotal($val) { if($val == 1) { return 1; } else { return $val * getTotal($val - 1); } } echo 'TOTAL: ' . getTotal(9);[/CODE] Works for values 1 and higher. Credits to [url]http://www.codewalkers.com/c/a/Miscellaneous/Recursion-in-PHP/1/[/url]

Member Avatar for asif49
0
80
Member Avatar for newbie14

You can do that just for the current script with the ini_set() function. [CODE]// on the beginning of your script save original memory limit $original_mem = ini_get('memory_limit'); // then set it to the value you think you need (experiment) ini_set('memory_limit','640M'); // at the end of the script set it to …

Member Avatar for broj1
0
4K
Member Avatar for tarunfuture

Existing textbox values can be changed with javascript. Get the element by it's ID and change its value property: [CODE]document.getElementById(myTextBoxId).value = 'This is my new value';[/CODE]

Member Avatar for tarunfuture
0
149
Member Avatar for fredy91

Why do you want to redirect to the admin page if you are already in the admin page?

Member Avatar for fredy91
0
162
Member Avatar for Ismatus3

First define values to checkboxes since values of the cliked checkboxes are returned in POST['checkboxes']. And note HTML input tag does not have aclosing tag (see below). [CODE]<input type="checkbox" name="boxes[]" value="N1" style="position: absolute; z-index: 10; top: 603px; left: 550px;" /> <input type="checkbox" name="boxes[]" value="N2" style="position: absolute; z-index: 10; top: 603px; …

Member Avatar for Ismatus3
0
135
Member Avatar for saybabs

Let us peep on your code just a little bit. I am sure it is a secret but promise we won't tell anyone.

Member Avatar for broj1
0
180
Member Avatar for huntaz556

Do a simple debugging. Check if your query is OK. Insert this code after line 19: [CODE]die($checksql);[/CODE] and enter the displayed query in phpMyAdmin (or other client). It should return 0 records or 1 record. Or check what is the count that the query returns. Insert this code after line …

Member Avatar for broj1
0
1K
Member Avatar for AceOfJames

Let PHP create the string with checkboxes and echo it. [CODE]// array of checkboxes $cbData = array('Time Savings', 'Cost Savings', 'Quality', 'Risk Management', 'Process and Procedure'); // initialize string for checkboxes $cbString = ''; // Get the length of the array then you just loop through the array and in …

Member Avatar for broj1
0
120
Member Avatar for wenothat

You have an error in line 1: [CODE]if ( ( "randgames.php", $_SERVER['PHP_SELF'] ) )[/CODE]The comma (,) is unexpected there but i think you forgot to put the function name: [CODE]if ( [COLOR="Red"][B]<some_function_here>[/B][/COLOR] ( "randgames.php", $_SERVER['PHP_SELF'] ) )[/CODE]

Member Avatar for broj1
0
161
Member Avatar for sidra 100

In line 14 the value should be enclosed with quotes ((X)HTML requirement), which should be escaped (since you double quotes are used as string identifiers), elements of an associative array enclosed in {} and associative index enclosed in single quotes: [CODE]echo "<option value=\"{$menu['product_name']}\">{$menu['product_name']}</option>";[/CODE] If it still does not work check …

Member Avatar for sidra 100
0
180
Member Avatar for showman13

I think PDF file generated from data stored in a database would be the most accurate thing. For generating PDF I recommend using TCPDF library ([url]http://www.tcpdf.org/[/url]) which is mature, supported and with plenty of examples. It is worth spending a day or two to learn how to use it.

Member Avatar for showman13
0
1K
Member Avatar for prasanna123

Make the background of the top image (Home button) transparent. You will need to convert it to png or gif since jpg does not support transparency.

Member Avatar for broj1
0
145
Member Avatar for zacharysr

I do not know if this causes the error but you are missing an apostrophe after 75 in height='75. Also check if $title contain anything.

Member Avatar for broj1
0
168
Member Avatar for cascer1

Just do the session_start() on the very beginning of the script and without the if statement.

Member Avatar for broj1
0
89
Member Avatar for davy_yg

You send some html (<body>...) before session_start() which is not allowed (unless you buffer of output or do not use cookie based session). Move session functions to the beginning of the script.

Member Avatar for davy_yg
0
186
Member Avatar for nakresimin

Obviously your PHP code gets displayed instead of processed. Looking at the page source the code is between PHP short tags <? and ?>, which are maybe not allowed on this server. Try to use proper tags: <?php and ?>. Or check if all PHP block tags are in pairs.

Member Avatar for broj1
0
215
Member Avatar for nguoixanh

<= in this case means less than or equal to or in your example: if the value of attribute $this->total_pages is less than or equal to a value of attribute $this->scroll_pages, then ... See [url]http://php.net/manual/en/language.operators.comparison.php[/url] Attributes are variables of classes/objects, similar to properties in some other OOP languages. The -> …

Member Avatar for almostbob
0
149
Member Avatar for violaceous

You can define the height of the td element in pixels or em. [CODE]function myError($text, $kill=0){ echo "<br><table class='popmessage' align=center cellpadding=5> <tr><td style=\"height:50px;\"><center><b>$text</td></tr> </table><br>"; if($kill){include('footer.php');} }[/CODE] This is how the cell will be alwas the same height (unless you display a very long message). I prefer to use divs instead …

Member Avatar for violaceous
0
152
Member Avatar for Cidco71

What do you want to achieve with saving a php block in a variable? If you call this variable you already have to be within <?php ?> tags?

Member Avatar for diafol
0
94
Member Avatar for BenzZz

If this happens in a browser that haven't been used to access the app yet, it is an issue with your code (it's a good idea to test your app in all popular browsers anyway).

Member Avatar for broj1
0
158
Member Avatar for badface

[CODE]<?php ? // start a html table echo "<table>"; // suppose you have your query result stored in $result while($row = mysqli_fetch_assoc($result)) { // suppose this is your user from the database $fullName = $row['fullName']; // suppose this is user ID that helps constructing a link to where profiles are …

Member Avatar for broj1
0
104
Member Avatar for Catweazle

The second and third link on this page are broken. They open a page saying: Invalid FAQ Item specified. If you followed a valid link, please notify the administrator Just thought you might want to know. [QUOTE=Catweazle;53483]Hi, and welcome to TechTalk. Perhaps the first thing you should do is have …

Member Avatar for WaltP
3
1K
Member Avatar for jabeen123

I do not know whether this is done professionally but I'll give it a try. [CODE] // change date of admission to unix timestamp $adm = strtotime($row['date_of_admission']); // get current time in a form of a timestamp $now = strtotime("now"); // get the difference in seconds $diff = $now - …

Member Avatar for diafol
0
127
Member Avatar for nic3500

My approach in the application I work on is that PHP generates all the HTML code. I have a class that generates all parts of a page that are not affected by business logic (similar to Pear HTML_Page class, see [url]http://pear.php.net/package/HTML_Page2[/url]). This class uses some other classes for footer, header, …

Member Avatar for Weliaz
0
507

The End.