PHP Database
I have a issue with my subscribe.php
i want when a email is typed in the text box to put the email in the database
though it isnt going there, here is the code
<?php
if(isset($_POST['add'])){
require_once('mysqlCreds.php');
$email = $_POST['email'];
if($email == ''){
header('Refresh: 5; url=http://szeryk.com/homepage');
echo "<div style='color: #FFFFFF;'>Please enter an email address to subscribe.</div>
echo "<div style='color: #FFFFFF;'>If you aren't re-dreicted in a few seconds please click <a href='http://szeryk.com/homepage'>here</a></div>";
$result = mysql_query("SELECT * FROM emailList WHERE email='$email' LIMIT 1")or die(mysql_error());
while($row = mysql_fetch_array($result)){
if($row['email'] == $email){
header('Refresh: 5; url=http://szeryk.com/homepage');
echo "<div style='color: #FFFFFF;'>We are sorry, but this Email address is already subscribed.</div>
echo "<div style='color: #FFFFFF;'>If you aren't re-dreicted in a few seconds please click <a href='http://szeryk.com/homepage/'>here</a></div>";
mysql_query("INSERT INTO emailList (id, email) VALUES('', '$email') ")or die(mysql_error());
header('Refresh: 5; url=http://szeryk.com/homepage');
echo "<div style='color: #FFFFFF;'>Thank you for subscribing to the newsleter!</div>";
echo "
echo "<div style='color: #FFFFFF;'>If you aren't re-dreicted in a few seconds please click <a href='http://szeryk.com/homepage'>here</a></div>"; }
?>
though if you can help me i will pay you BIG TIME
if you can use teamviewer add me on msn
[email protected]
thanks
Check below updated code:
<?php
if(isset($_POST['add']))
require_once('mysqlCreds.php');
$email = trim($_POST['email']);
if($email == '')
header('Refresh: 5; url=http://szeryk.com/homepage');
echo "<div style='color: #FFFFFF;'>Please enter an email address to subscribe.</div>
echo "<div style='color: #FFFFFF;'>If you aren't re-dreicted in a few seconds please click <a href='http://szeryk.com/homepage'>here</a></div>";
$result = mysql_query("SELECT * FROM emailList WHERE email = '".$email."' LIMIT 1")or die(mysql_error());
if(mysql_num_rows($result) > 0)
header('Refresh: 5; url=http://szeryk.com/homepage');
echo "<div style='color: #FFFFFF;'>We are sorry, but this Email address is already subscribed.</div>
echo "<div style='color: #FFFFFF;'>If you aren't re-dreicted in a few seconds please click <a href='http://szeryk.com/homepage/'>here</a></div>";
else
mysql_query("INSERT INTO emailList (id, email) VALUES('', '".$email."') ")or die(mysql_error());
header('Refresh: 5; url=http://szeryk.com/homepage');
echo "<div style='color: #FFFFFF;'>Thank you for subscribing to the newsleter!</div>";
echo "
echo "<div style='color: #FFFFFF;'>If you aren't re-dreicted in a few seconds please click <a href='http://szeryk.com/homepage'>here</a></div>";
?>
I hope this will help you to find your answer
Similar Messages
-
Need Help with IMG+PHP Database+Selective Display
The problem is really a lot simpler than I made it sounds to
be, though I fear the answer might be vice versa.
I need to have pictures appear when they exist. That's all.
Here is where I am at:
I have created a php database for a news announcement page.
In that database, I have a column named "img" whose default value
is "null"
Whenever I actually have a picture corrosponding to a
particular news, the "img" column will change to the file name of
that image, which I will then extract.
So basically... if news A, img = null... no picture. news B
img = b... then yes picture. very simple concept for database.
Here's what I can't do.
When I read the database from DW, how can I make it so that
when it reads a "null" it won't insert a picture and vice versa? I
figure it definitely has to do with the "if" statement (duh...)
I know how to make text do that effect...
<? if $row_data['text'] != null
echo("i have data");
?>
but how do i do it with an image? I tried putting the image
tag to replace the entire "echo" line, but that's apparently not
how you do it. I tried putting it inside "echo", but that doesn't
seem to be it either.
also, as a premise, all pictures are associated with only 1
particular news.
which i wrote something similar to this:
<img src="<?php echo $row_data['img']; ?>.jpg"
width="200" height="200" />
Um, basically... I need THAT to fit into the IF statement. So
thanks in advance.if (!is_null($row_data['img']))
echo '<img src="',$row_data['img'],'.jpg" width="200"
height="200" />';
Let's break that down into the following:
echo '<img src="' ;
echo $row_data['img'] ;
echo '.jpg" width="200" height="200" />' ;
When you string multiple echoes together use a comma between
them,. so now
we have:
echo '<img src="',$row_data['img'],'.jpg" width="200"
height="200" />';
(You may also use a period, but my understanding is the
period is less
efficient.)
I only have single quotes in my PHP statements. The double
quotes you see
are part of what will be the rendered HTML.
You may generally use the single quote or double quote
interchangeably with
few exceptions such as having double quotes as part of the
text or vice
versa among others. You can probably escape the characters
too, but lets
keep this simple for now.
If I misspoke I am sure Micha will be sure to correct me.
IMO The best thing to do is learn by trial and error, and
your best resource
on the net for PHP is probably the php website. www.php.net
"Bih Wang" <[email protected]> wrote in
message
news:gr3p0m$293$[email protected]..
> thanks so much!
>
> is how i interpret the code correct?
>
> if (!is_null($row_data['img'])) ---> if img is false
> echo <--- maybe i been using this without
understanding it correctly...
> echo
> means to display on screen but not limited to text
right?
>
> and the rest is where you lost me... i don't get the
punctuations
>
> bracket double quote (" is for text right?
> so single quote ' means to accept a php function or html
code?
>
> so can i do this?
> '<div bob>blah'
> and have div bob appear only when the conditions are
met?
>
> and external data is define by comma?
> such as... if i pre-define value "x"
> so i can do img src=',x,'.jpg?
>
> thanks again! is there a tutorial i can read for these?
>
> -
Possible to update Numbers document from PHP database?
Hello!
I've been hoping to figure out a way to do this: I have an online php database attached to a webstore that contains product inventory. I have an offline Numbers spreadsheet that we use for keeping track of our inventory.
Periodically I have to manually update the Numbers document with the current inventory from our website (as stored in the PHP database).
Is there a way to have the Numbers document "automatically" update the values of cells based on the contents of the PHP database?
Ideally (and I know this is probably not possible) I'd like the Numbers document to be the "front end" for controlling the values in the PHP database -- so I can view current inventory in the Numbers document, and can update to the PHP database FROM my Numbers document if I decide to manually change some inventory numbers.
Theoretically it's simple: attaching a specific cell in the Numbers sheet to a specific value in the PHP database... but I have no idea if there's an actual way to make this connection...!
Or maybe I'm just using the wrong software?
Any thoughts or ideas would be greatly appreciated!schrysco wrote:
thanks! any ideas on how to do this?
do what ?
grabbing quotes
or
grabbing PHP datas ?
Grabbing quotes is done with a script available on my iDisk :
<http://public.me.com/koenigyvan>
Download :
For_iWork:iWork '09:forNumbers09:insertquotes.zip
For PHP, I have absolutely no experience with this beast.
Yvan KOENIG (VALLAURIS, France) vendredi 29 janvier 2010 18:07:09 -
Apostrophe displays incorrectly in text in PHP database field
I have a PHP database with several text fields. If the text
contains an apostrophe, the apostrophe displays as a small box
on the web page. How can I tell Dreamweaver to display this character correctly?Hi KT,
Thanks for the advice, but opening Safari in 32 Bit mode didn't help, also when I copy the text from safari in to text edit it looks the same. Text displays correctly on my macbook which has Safari 4 and 10.6.1 so I don't understand!!! Thanks again. Cheers, Mark -
[SOLVED] Zabbix installation blocked - PHP database support missing?
Hello everyone!
I'm trying to install zabbix following the wiki (the mysql version: zabbix-server-mysql from AUR),
on a working LAMP server (up to date).
The package installs, but when I try to take the last steps of the installation (from http://localhost/my_zabbix_installation),
on page two (Check of pre-requisites) it marks:
"PHP databases support off Fail"
according to php, mysql support is enabled. (extension=mysql.so is commented out in /etc/php/php.ini)
What can cause this?
Last edited by scar (2014-08-05 16:16:47)It is not bug. Read PHP extensions
uncommet in file /etc/php/php.ini
extension=mysqli.so -
SEO with PHP/Database driven sites
I know this is the wrong place for this question but I wanted the opinion of this forum.
My company is in the planning stages of building a new site. It's currently PHP/Database driven but for the amount of products we have in our lineup, it's not really necessary. I'm heading up the SEO for the new site and have been looking into it the past few weeks.
From what I've read here and there, PHP isn't too search engine friendly. There aren't any recent articles online that I can find on the subject so I would like to know your opinion. The new site can be created just as well with HTML/CSS and we plan to go crazy with SEO. From what you guys know about SEO, would you recommend staying with PHP or moving over to HTML?
Thanks in advance...No, there is no difference. The only thing to ensure is that your 'meta' description is also individualised for each item/page and that any images contain a title attribute individual to the image and not the generic "product image" title, (or similar) that many include.
This is what I've learned. I'm excited to begin the whole process. We have many websites that need to be re-done so we're trying to work out good plan before doing so. Designing for mobile came up after the first site was completed and I didn't have too much time to get into that, as you saw a few weeks back. Right now the page is only really built for Blackberry and once I was going to get into learning the media queries for the next two, I was put onto SEO.
We're a bbq company with a tonne of brands and things haven't been touched in years. Not a single person here knows anything about any of the websites. When I was hired a few months ago I was just thrown into the mix. As I'm sure you can imagine, things can get frustrating.
EDIT--
This is BOSS DJ. I made another account for work and for some reason they've switched them up. I signed in with Krumf and they gave me BOSS even though it said Welcome, Krumf up top. This window has been open ever since I signed in
Strange... -
Send webpage data from a php database or form to a printable PDF
i have a webpage that has data on it that comes from a php database. the data doesnt currently sit inside a form feild but it can be if need.
i need then to click a link and the data on the page + more is sent to a premade pdf form ( the form also has other data on it not coming from the webpage) then ready for printing
any ideas?You probably have a 'byte order marker' ( BOM ) at the beginning of the file. You can use my BOMStripperInputStream posted in reply #7 of http://forums.sun.com/thread.jspa?threadID=5310966 or you can just discard the BOM bytes from the InputStream before wrapping it in the BufferedReader.
Hi Sabre im facin the same probem.
bufferedReader = new BufferedReader(new InputStreamReader(new FileInputStream("C:/Documents and Settings/Administrator/Desktop/UTF8RDFiles/Example.txt"),"UTF-8"));
bufferedReader.readLine() returns a junk character ? at the beginning of the line.
you have instructed to use your BOMStripperInputStream posted in reply #7 of http://forums.sun.com/thread.jspa?threadID=5310966 but i dotn know how to use it with bufferedReader because i want my method to return only a BufferedReader object.
can you suggest me how to go about it.
my code is as below need help.
public BufferedReader check(){
bufferedReader = new BufferedReader(new InputStreamReader(new FileInputStream("C:/Documents and Settings/Administrator/Desktop/UTF8RDFiles/Example.txt"),"UTF-8"));
return bufferedReader; // need to return bufferedReader object only...since some other code needs bufferedReader ...suggest me.
i will be highly obliged if you paste the refined code.. please need your urgent help on this...
Regards
Deepak -
MySQL + apache2 + PHP Database connection error
Hi Folks:
I am trying to connect to the database and keep getting a 500
internal server error. here is the setup
Database server -- mysql 4.1 (linux) on a gentoo linux server
-- IP 192.168.0.10 -- srvdb-01
Webserver - Apache2 + PHP 5 on Gentoo Linux server
192.168.0.29 - srvweb-03
I have all the connections ready to go, dav is moving files
etc, but when i try to create a database connection, i keep getting
the following error
> PROPFIND /_mmServerScripts HTTP/1.1
> Authorization: Basic dGhvbG1lczp0eXBob29u
> User-Agent: Contribute/3.0
> Host: inventory.mcaschool.net
> Pragma: no-cache
> Accept: image/gif, image/x-xbitmap, image/jpeg,
image/pjpeg, */*
> MIME-Version: 1.0
> Content-Type: text/xml
> Content-Length: 134
> Depth: 0
> Connection: Keep-Alive
< HTTP/1.1 500 Internal Server Error
< Date: Tue, 25 Apr 2006 21:09:54 GMT
< Server: Apache
< Content-Length: 607
< Connection: close
< Content-Type: text/html; charset=iso-8859-1
(copied from the DW8 FTP LOG)
I am really baffled by this problem -- can someone please
point me in the direction of a solution?
thanks
Tim Holmes
IT MANAGER - Medina Christian AcademyDJtonyF wrote:
> ... the issue isnt with godaddy.com the issue is with
dreamweaver. the "localhost" connection i attemped to connect to
was one on my own server i setup on my computer.
How have you set up your Testing Server in the site
definition?
If your server root is C:\htdocs, and your site is in
C:\htdocs\mysite,
that's the value for "Testing server folder". The URL prefix
should be
http://localhost/mysite/.
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of
ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/ -
im attempting to a connect to a sql database using php. when
i create a new connection Dreamweaver always gives me an
"unexpected error" so it connot connect. the database is mysql 4.1
(on godaddy.com) and php 5 on the server.
i attemped to change it to "localhost" on my computer
thinking it was a godaddy problem but the same issue acures. Im not
sure what to doDJtonyF wrote:
> ... the issue isnt with godaddy.com the issue is with
dreamweaver. the "localhost" connection i attemped to connect to
was one on my own server i setup on my computer.
How have you set up your Testing Server in the site
definition?
If your server root is C:\htdocs, and your site is in
C:\htdocs\mysite,
that's the value for "Testing server folder". The URL prefix
should be
http://localhost/mysite/.
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of
ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/ -
PHP database connection strategy
Hello everyone,
I'm currently writing a website with PHP and MySQL.
I would like to know which strategy you choose to manage database connection.
I did not find any way to have a database connection pooling in PHP like I usally use in J2EE.
My current strategy is some kind of singleton my front controller will share with all "sub controller".
So, to render a page, I'll have a single static connection ( using PDO ). Opened at the beginning and closed at the end of the page.
So, what do you use in your PHP webapps?
Regards.zenlord wrote:
litemotiv wrote:Open just on the start of the page though, collect all data in an object, close the connection and then print out.
Care to give me an example, or point me to an online example of this?
I'm merely an amateur, and don't understand things like 'singletons' - I do think that I currently code in MVC, but I would like to know more about design patterns. When it comes to db-connections, I think I open the connection, load all the needed data and close the connection. Don't know whether I 'collect the data in an object', though
If you search a very good book, my suggestion is:
http://www.amazon.com/Objects-Patterns- … 982&sr=8-1
Seriouly, a must have!
litemotiv wrote:Open just on the start of the page though, collect all data in an object, close the connection and then print out.
Great to see I'm not completely wrong
Nagian wrote:but have you already read the Zend Framework Quickstart?
Yep, I know Zend. But I want to create something without any framework to learn and improve my php knowledge. -
Safari hangs when posting forms on php database driven sites
Hello,
I build php MySQL database driven sites all day long, and over the last year i have noticed that when using safari and "Only Safari"... If i post a form which submits data to the database the page hangs for about a minute and then ends up on a blank page. (the data was successfully submitted to database though)
This does not happen for any other browser, only safari. It happnes on at least 10 sites i have built. i thought it was an quirky issue with my computer, but now it is happening to a client.
also this, doesnt happen to any ASP sites I build, only safari and php/mysql
My safari is 2.0.4Hi,
From your Safari menu bar click Safari / Preferences then select the Extensions tab. If you have any installed, then turn off, restart Safari. Try a site that uses web based forms.
If it's not Extensions causing this, from the menu bar again, click Safari / Preferences - Autofill.
Click the Edit button next to *Other forms*
Click: Remove All then click Done.
Restart Safari. Try again. If that didn't help, back to the menu bar, click Safari / Reset Safari. Select the top 7 buttons, click Reset. Restart Safari. Try again...
Carolyn -
Uploading images for a mySQL / PHP database
Hopefully this can be done - I'm working on a site that uses
a simple mySQL database, where the records include an image.
I have the form to add records, including the field
containing the file name - but is it also possible to upload the
actual file using the same form to their folder, or does that need
to be done separately using FTP software?
The idea is for my client to be able to as easily as possible
add / delete / edit records himself, so clearly getting the actual
images uploaded at the same point he adds records to the database
would be great if that's possible.
Cheers,
IainThe PHP.NET site really covers it in considerable detail.
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com
- Template Triage!
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
http://www.macromedia.com/support/search/
- Macromedia (MM) Technotes
==================
"David Powers" <[email protected]> wrote in message
news:ejo4qf$ee3$[email protected]..
> Iain71 wrote:
>> Cheers for that - not sure exactly what I need to do
tho'
>
> I'm sure there are plenty of online tutorials if you
Google for them. I
> also cover file uploads in my new book, PHP Solutions.
It's not
> particularly difficult, but there are quite a few steps,
and you need to
> be aware of security considerations.
>
> --
> David Powers
> Adobe Community Expert
> Author, "Foundation PHP for Dreamweaver 8" (friends of
ED)
>
http://foundationphp.com/ -
Flash form to PHP/database
i'm going crazy and i hope someone can help me
here is the script i'm trying to pass to the php page
PHP Checkbox tutorial
www.flashscript.biz, 2005
stop ();
// importing button and checkbox class
var name_txt:mx.controls.TextInput;
var email_txt:mx.controls.TextInput;
var company_txt:mx.controls.TextInput;
var newsletter:mx.controls.CheckBox;
var submitBut:mx.controls.Button;
var messageBox:TextField;
// LoadVars objects
var lv:LoadVars;
lv = new LoadVars ();
var lvAnswer:LoadVars;
lvAnswer = new LoadVars ();
// button label
submitBut.label = "Submit";
// we give "myCheckbox" a default value
var myCheckbox:String;
myCheckbox = "selected";
// we create a listener for the checkbox to increase either
number
var checkListener:Object = new Object ();
checkListener.click = function () {
// here we let the user select
if (newsletter.selected) {
myCheckbox = "isSelected";
} else {
myCheckbox = "not selected";
newsletter.addEventListener ("click", checkListener);
// sending out the data
submitBut.onRelease = function () {
messageBox.text="Please wait.";
lv.name_txt = name_txt;
lv.email_txt = email_txt;
lv.company_txt = company_txt;
lv.myCheckbox = newsletter;
lv.action = "send";
lv.sendAndLoad ("includes/techinfo_signup.php", lvAnswer,
"POST");
// receiving the data from the php file
lvAnswer.onLoad = function () {
messageBox.text = this.result;
the text field caomes back as undefined
the php page is calling
name_txt
email_txt
company_txt
myCheckbox / newsletter
here is the url so you can see what i'm talking about...
http://www.lightningmedia.com/form_test.php
any help would save me life.... thanks
cheers
-n8ok so i;ve gon back to the down a dirty way of doing this...
http://www.lightningmedia.com/form_test.php
(technical info tab)
each text field has a Var: Name, email, and company
i've used the CheckBox component
i;ve placed the fallowing code on the submit button
on (release) {
if (!email.length || email.indexOf("@") == -1 ||
email.indexOf(".") == -1) {
EmailStatus = "Please enter a valid E-mail address";
} else {
loadVariablesNum("includes/techinfo_signup.php", 0, "POST");
this.gotoAndStop(2);
easy enough right?
everything works fine but the CheckBox......
i'm trying to send a 1 or 0 to the database.
i've given the component a
fieldname: newsletter (the same as the field in the database)
data type: Boolean
required: true
Read only: false
kind: data
formatter:none
encoding:none
default value:1
path: includes/techinfo_signup.php
storage type: simple
so what am i missing? i'm at a loss...
thanks again -
Hey all-
I am trying to find a tutorial that can walk me through setting up a remote database on a server such as Godaddy. I completed David Powers' "building your first dynamic website" and I am trying to find some instruction on how to do the same thing but on a remote server.
Sorry if I asked this question in the wrong place. I'm very new to the Adobe forum...
WarrenKen Wright Consulting wrote:
- I'm using MySQL ODBC Driver 5.1
Dreamweaver doesn't use the MySQL ODBC driver. It uses the PHP MySQL extension, which is not enabled by default in PHP.
The method of enabling the MySQL extension depends on how you installed PHP. However you can check whether it's enabled by running <?php phpinfo(); ?> in a PHP page. Scroll down the page of configuration details to see if MySQL is listed. -
J2ME and PHP DATABASE CONNECTION
Hi ALL
I am writing an application that need to pull information from a database. I have a Tomcat server set up. I am using MySQL as my database. I was planning to use PHP to pull information from the database. I just do not know to use J2ME with PHP. In other words once I pull the desired information from the database how do would I then display it using J2ME. Does any one have any good books or web references, where I can begin to start looking.
Thanks for your helpI have created a solution with the exact configuration you describe (www.i2score.com in swedish). You dont have to use J2ME with PHP. They work independetly from each other. My J2ME Midlet serialize and de-serializ the information, communicate via HTTP to the Java servlets running on the Tomcat server. The servlets put and get info from the MySQL database.
On the same server (could be a seperate if you want) PHP pages with MySQL coupling is used for web access to information on the same database but put and get. Very neat in my opinion. Good luck with your project. Be more precise with your roblems if you want more help.
Maybe you are looking for
-
I upgraded to Itunes 7, and now it wont open. I get no error message. I have tried the things apple said to try. That does not work either. Quicktime works fine. I just cant open Itunes. I really just want to get into Itunes. I was ok with it for awh
-
Pls urgent reply will be appreciated
A form i enclosed in a jscrollpane doesnt print the full form. It only prints the part visible on the screen. I,ve done all the 2d tricks like clipping, setting my imageable area all as i can... pls urgent reply to this will be appreciated; i attach
-
App Store Needs: tabs, demos, blurbs, screenshot zoom, etc.
In my first hour of looking at the new Mac App Store I can see that it needs the following: - Tabbed Browsing - Demo Downloads - Blurbs in Browsing (all the time or via hover) - Wish List - Watch List - Gift List - Screenshot Zoom-in - Videos in scre
-
The enhanced picture uploaded for ebay is not visible in Firefox but is in IE
I sell on ebay and like using the enhanced picture uploader. I still able to use this uploader on IE but Firefox does not even allow ebay to show it as an option. I am very new to Firefox so I am certain it is a setting I need to change. Any and all
-
Benefits of Airport Express wireless printing VS. built in printer WiFi?
I currently use an Airport Express N to enable my old HP laser jet for wireless printing. The HP just stopped working and I need to buy a new one. I'm seeing built in WiFi in some printers today, so I'm wondering if there is a benefit to still using