
bbaker
Members-
Posts
127 -
Joined
-
Last visited
Everything posted by bbaker
-
from the imagettftext documentation on php.net [url=http://us2.php.net/manual/en/function.imagettftext.php]http://us2.php.net/manual/en/function.imagettftext.php[/url] [quote] Depending on which version of the GD library PHP is using, when fontfile does not begin with a leading / then .ttf will be appended to the filename and the library will attempt to search for that filename along a library-defined font path.[/quote] maybe try dropping the .ttf in your ImageTTFText function? [code]ImageTTFText($TheImage, 12, -5, 16, 20, $ColorText, "times", $secret); [/code]
-
$query = mysql_query("SELECT * FROM $table WHERE mls = [b][!--coloro:#FF0000--][span style=\"color:#FF0000\"][!--/coloro--]'[!--colorc--][/span][!--/colorc--][/b] $MLS [b][!--coloro:#FF0000--][span style=\"color:#FF0000\"][!--/coloro--]'[!--colorc--][/span][!--/colorc--][/b] ") or die(mysql_error());
-
I've modified the lists & definition lists to text as white & the arrows, numbers as blue I may change the blockquotes as jcombs said....but I'm going to look at those a bit more before I jump it. ....any more thoughts are appreciated.
-
I agree with the above posts that it is confusing. Maybe instead of saying "You URL is:" You could say, "Please the URL you wish to Scrutinize". Change the GO button to "SET URL". Then instruct the user to click the links below to scrutinize the URL they just entered.
-
I submitted a redesign of this site a while back & there was clearly a lot that need to be changed. I wasn't sure how I was going to layout my content...etc, etc. well...I've redesigned my redeign! I've totally overhauled it and I think I have a winner! I've started working on the backend, but any more insight from other will be appreciated. [a href=\"http://www.bakerdev.com/2006/\" target=\"_blank\"]http://www.bakerdev.com/2006/[/a]
-
right off the bat....it doesn't align correctly in Firefox or Opera. In IE6, FF & Opera your banner overlaps the main content area. i like simple designs, but this may be a bit too simple. the banner looks like you're attempting to have rounded corners on the right side, but the background of the image doesn't match the background of the body. I'd also try the main text as white intead of black. Will give a bit more contrast & seperate it more from your menus.
-
you have to set the $username variable: $username = $_SESSION['username'];
-
it doesn't do anything because you never executed the query. You constructed the query string: $query="SELECT avg( q6 ) FROM `survey` avg(q6)" (which is incorrect syntax), but didn't execute with mysql_query(). You also didn't fetch the results. try this: [code]<?php $query = "SELECT AVG(q6) AS avg FROM survey"; $result = mysql_query($query) or die(mysql_error()."<br />Couldn't execute query: $query"); $row = mysql_fetch_array($result); echo $row['avg']; ?> [/code]
-
the server might not allow PHP on pages with the .html extension if you change your page to a .php extension is should work fine. if you can't change it to .php & you MUST have it as .html, then use: AddType application/x-httpd-php .html .php .htm This will force the server to read .html pages as .php pages & your PHP code will work.
-
the server may not allow php to be shown on pages with the .html extension. Is this site on an Apache server? if so, you can add this to a .htaccess file to get your html pages to be read as php AddType application/x-httpd-php .html .php .htm
-
<?php echo $_SERVER['REMOTE_ADDR']; ?>
-
can you show your code for the form with the textarea & the code you're using to attempt updating your database.
-
[!--quoteo(post=369386:date=Apr 27 2006, 06:29 PM:name=arre)--][div class=\'quotetop\']QUOTE(arre @ Apr 27 2006, 06:29 PM) [snapback]369386[/snapback][/div][div class=\'quotemain\'][!--quotec--] I tried to run the code-example you gave me bbaker, but now it only inserts. How does the code compare the name if it's already in the database? [/quote] I tested this on my server & it works fine for me. if the name already exists, the $num_rows = ifx_num_rows($result); will equal 1 if the name does NOT exist, $num_rows = ifx_num_rows($result); will equal 0 so the if statement: [i]if ($num_rows >= 1)[/i] basically says if $num_rows is greater than or equal to 1, UPDATE. If it's not greater than or equal to 1 (meaning 0), INSERT. You should NOT use a query that checks for a NULL name. If the name does not exist in the database, it cannot be NULL. On this same note, you should do some sort of validation for the name & email address so that you don't get duplicates AND to make sure the user enters a name & email. If they leave it blank, you'll have NULL entries(maybe multiple NULL entries). If you do have multiple NULL entries & run the script searching where name = NULL, it'll update ALL NULL names with the new info.
-
I've had a problems before with table names & field names that were pretty "generic" or could be used by or mistaken as something else. By renaming the table and/or field name, the problem was solved. try renaming your table to addresses or user_address or somthing similar. & of course, update your query to reflect the same. I'm not guaranteeing that it'll work for you, but it's worth a shot.
-
#1 (if the query must satisfy [i]BOTH[/i] WHERE conditions, replace AND with OR if it can meet one or the other.) guess you already got it ;]
-
another way to do it: [code]////////////////////////////////////////////////// function checkUser($name,$mail) { $conn_id = ifx_connect ("db@atkin") or die("Cant open database"); $query = "SELECT name FROM bUser where name = '$name'"; // ### MODIFIED ### only need 1 = sign $result = ifx_query ($query, $conn_id) or die("Cant SELECT"); $num_rows = ifx_num_rows($result); // ### ADDED ### - checks number of rows resulted from query if ($num_rows >= 1) // ### MODIFIED ### if user exists $num_rows will be >= 1 and will run update, else it'll run insert. { print "UPDATE"; $query = "UPDATE bUser SET email = '$mail' where name = '$name'"; // ### MODIFIED ### only need 1 = sign $result = ifx_query ($query, $conn_id) or die("Cant UPDATE"); } else { print "INSERT"; $query = "INSERT INTO bUser Values ('$name','$mail')"; $result = ifx_query ($query, $conn_id) or die("Cant INSERT"); } ifx_free_result($result); ifx_close($conn_id); } ?> [/code]
-
you also have to change select_sleeps to sleeps, select_board to boards....etc. [i]how do i say that it needs to choose that type from the drop down list which is called "select_type"?[/i] you took care of that with $type = $_POST["select_type"]; that pulls the value from your form (as long as your form method="post").
-
Remove special charactars before insert into database
bbaker replied to lilywong's topic in PHP Coding Help
will other e-mails have the same [i]syntax[/i] as 110007;"mici@tm.net.my"? or could it be something different? if they will only have a syntax like the example the following function would work [code]function clean_email($email){ if (strstr($email, ';') == TRUE) { $email = split(';',$email); //splits string at; $email[0] will be '110007' $email[1] will be "mici@tm.net.my" $email = str_replace('"','',$email[1]); //removes " from $email[1] } return $email; // returns mici@tm.net.my }[/code] to use the function [code]$email = '110007;"mici@tm.net.my"'; echo clean_email($email); //returns mici@tm.net.my[/code] -
Needing MAJOR help with adding to a database..
bbaker replied to ChambeRFienD's topic in PHP Coding Help
if you have [i]magic_quotes_gpc[/i] set to ON, it is by default, you do not need to use addslashes(). You may be double escaping. -
if you have register_globals set to off in your php.ini, session_register will not work. You should use $_SESSION instead. $_SESSION['morgage_type'] = $morgage_type; $_SESSION['loan_amount'] = $loan_amount; $_SESSION['loan_type'] = $loan_type; $_SESSION['amortization_type'] = $amortization_type; etc...etc.
-
I didn't look too hard at your code, but you're looks like your 2nd " is in the wrong place in your query string. [!--coloro:#999999--][span style=\"color:#999999\"][!--/coloro--][i]$result = mysql_query("SELECT city_id, City FROM city WHERE country_id =[b][!--coloro:#FF0000--][span style=\"color:#FF0000\"][!--/coloro--]"[!--colorc--][/span][!--/colorc--][/b].$country_id); [/i][!--colorc--][/span][!--/colorc--] try this instead, separate your query from your execution & make sure your query is executed: [code] $query = "SELECT city_id, City FROM city WHERE country_id ='$country_id' "; //query code $result = mysql_query($query) or die (mysql_error()."<br />Couldn't execute query: $query"); //execute!, if there is something wrong with your query, this will let you know where it is.[/code]
-
[code] $query = "SELECT * FROM table"; $result = mysql_query($query) or die (mysql_error()."<br />Couldn't execute query: $query"); $num_results = mysql_num_rows($result); echo "We currently have $num_results members"; [/code]
-
are you using " " or just pressing the space bar? If pressing the space bar, your browser will ignore the "whitespace" of the spaces. OR you can do it correctly & use CSS to do your indents. :) [code]p { text-indent: 10px }[/code] will indent the first line.
-
the other posts are absolutely correct....next time, I'll think before I speak. I apologize for the bad info.
-
[b][i]1. Is there any php function that checks variable existence?[/i][/b] There are ways to check this, not sure if there is a specific function though. Here's one way to check if a variable exists. [code] if (!$var){ echo '$var does not exist'; } else { echo '$var exists!'; } [/code] [b][i]2. Is there any php function that refreshes page?[/i][/b] No, PHP is a server side language.....use javascript for this.