473,614 Members | 2,076 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem Loading Two db Tables with Script

The purpose of the script below is to load the same news item into two
different MySQL tables (thus displaying the same news item on two web
pages). The problem I am having is this: The script actually
works--but just once. The next time I run it (even days later), it
will not load the data. It just displays the error message from line
#37; in other words, there is no value in $result.

(BTW, I have stripped out all security temporarily. I understand that
in its present form this is an insecure script. It is not being left
on the server.)

Server PHP: 4.3.4
Server MySQL: 3.23.58

Can anyone figure out why this script would successfully load the two
tables, but only once? Thank you for your time and consideration.

dsl

------------------------------

<html>
<?php
$strTitle = 'Post Weekly News';
require ("header.php ");
?>
<body>
<div id="center">
<FORM action="<?=$PHP _SELF?>" method="POST">
<p>Headline: <br>
<INPUT TYPE="text" NAME="headline" SIZE="50" /><br>
<p>Story text: <br>
<TEXTAREA NAME="story" ROWS="10" COLS="50" /></TEXTAREA><br>
<p>Start Date: <br>
<INPUT TYPE="text" NAME="initdate" SIZE="12" /><br>
<p>End Date: <br>
<INPUT TYPE="text" NAME="expdate" SIZE="12" /></p>
<INPUT TYPE=submit name="reg2" VALUE="Submit" />
<INPUT TYPE=reset VALUE="Clear Fields" />
</FORM>
<?php
// Connect to the database server
$dbcnx = @mysql_connect( "localhost" , <user>, <password>);
if (!$dbcnx) exit();
// Select the database
if (! @mysql_select_d b("<db_name>" )) exit();
if (!isset($reg2)) {
echo("No submission yet.");
}else{
// load row into news table
$sql = "insert into news set
headline='$head line',
story='$story',
initdate='$init date',
expdate='$expda te'";
$result = (@mysql_query($ sql));
if (!$result) {
echo("<p>ERROR: <b>News</b> table NOT loaded.</p>");
}else{
echo("<p><b>New s</b> table loaded.</p>");
}
if ($result) {
$sql2 = "insert into hc_news set
headline='$head line',
story='$story',
initdate='$init date',
expdate='$expda te'";
$result2 = (@mysql_query($ sql2));
if (!$result2) {
echo("<p>ERROR: <b>HC_News</b> table NOT
loaded.</p>");
}else{
echo("<p><b>HC_ News</b> table loaded.</p>");
echo("<p>Both tables loaded successfully.</p>");
}
}
}
?>
</div>
</body>
</html>

Jul 17 '05 #1
0 1490

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
1532
by: Cenk Genisol | last post by:
Hi NG, I am relatively new to Web developement and have some questions to you. I've got a Masterpage where some graphics are embedded by CSS. They format the borders of tables, which store page content so it's just an optical background. During the process of loading the page on the client, pages which implement the above mentioned masterpage are build very excursive. That looks
2
2834
by: nick.taylor | last post by:
Hi, I've been trying for weeks to figure out this problem. I'm developing a simple Javascript app that loads an XML file from a server, parses the contents, and displays them. But I am encountering a very mysterious bug that I can't seem to get rid of. When loading the page in Internet Explorer, everything works, and in Firefox it works except for one problem: the page never stops loading. The script runs and everything parses but it...
13
2149
by: Jon Paal | last post by:
this works as shown: <script Language="javascript" src="http://127.0.0.1/syndicate.ashx?d=suppliers"></script> is there a way to set src programmatically ??
5
10343
by: toffee | last post by:
Hi all, I've seen a really cool effect which i would like to use on an intranet site. Am referring to the 'LOADING..' animation you see when switching pages. I've seen it somewhere on a website that was using php (cant remember the url). I've tried googling but came up with nothing - so does anyone know what function of php allows to display a little animation while a sql query is being run ? Many thanks
2
2722
by: billkirim | last post by:
i am using this code to preload my site: <script type="text/javascript"> document.write('<div id="loading"><br><br>The musicase is Loading...</div>'); window.onload=function(){ document.getElementById("loading").style.display="none"; document.getElementById("central").style.display="block"; }
1
1901
by: mlikesit | last post by:
I am trying to get the following code to pre-load some images before re-dirrecting the user. The problem is that the onError event gets called for all of the images immediately. I've tripple checked that the images do in fact exist at the specific url, so I can't figure out why the onError is being called. The script is currently posted on http://www.mkcustomdesign.com/index.html. <script type="text/javascript"> var imagesToLoad = 0;...
0
1576
VietPP
by: VietPP | last post by:
Hi all, I've asked too much question in this day, hehe. I'm trying to export my table data in OracleDB to excel. The problem is my charset in database is US7ACSII (using Vietnamese font), when I exprort to excel it's changed to Unicode UTF-8 so all of the characters had lost, text cannot be display correctly. Is it possible to add a charset setting to code. Thank you!
11
3714
by: Flexor | last post by:
I have a php script that runs from command line and makes an https request to paypal, using curl. It works fine if I run it from a web page. It fails if I run it from CLI. The error I get from the CLI: * About to connect() to api-3t.sandbox.paypal.com port 443 * Trying 216.113.191.88... * connected * Connected to api-3t.sandbox.paypal.com (216.113.191.88) port 443 * successfully set certificate verify locations: * CAfile:...
0
8182
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8130
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8627
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8579
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8433
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6088
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5540
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2568
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1747
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.