I have various functions such as this throughout my script -
function db1_select_query($sql) {
-
// Always query db1
-
db1_connection();
-
$res = mysql_query($sql);
-
if (!$res) {
-
echo("<P>Error performing query select: " . mysql_error() . "</P>");
-
exit();
-
}
-
db_close_connection1();
-
return $res;
-
}
-
and -
function get_complete_record($id) {
-
// Declare Varibles Global or outside the function
-
global $product_id, $title, $ac_type, $brief_desc,
-
$description,$expiry_date, $tech_specs;
-
-
if ($id == '') {
-
$sql = "select * from product where product_id = '" . $_GET['product_id'] . "'";
-
} else {
-
$sql = "select * from product where product_id = '" . $id . "'";
-
}
-
-
if ($debug) echo ($sql);
-
-
-
$result = db1_select_query($sql);
-
-
// $result equals the number of rows effected
-
// It should always equal 1
-
if (mysql_numrows($result) == 0) {
-
// Session not established
-
return false;
-
exit();
-
}
-
-
// Populate Variables
-
$product_id=mysql_result($result,0,"product_id");
-
$title=mysql_result($result,0,"title");
-
$ac_type=mysql_result($result,0,"ac_type");
-
$brief_desc=mysql_result($result,0,"brief_desc");
-
$description=mysql_result($result,0,"description");
-
$tech_specs=mysql_result($result,0,"tech_specs");
-
-
// Close up result set
-
mysql_free_result($result);
-
return true;
-
}
-
but it seems to break the script right at the function *() { line
however I don't see anything wrong with it and I know that it's suppose to work since the website has worked before and I was just given all the files to push up on the server I am working on now.
5 2136 Markus 6,050
Recognized Expert Expert
What do you mean 'it breaks'? Any errors?
Weird, the website timed out on me when I tried editing my post to include that part.
For some reason when I add the three lines below to the top of the script still nothing happens, even though it is suppose to display something when I test it with echo "no it doesnt work". I don't get any errors; just a blank page. -
ini_set('error_reporting', E_ALL);
-
ini_set('display_errors', 'On');
-
ini_set('display_startup_errors', 'On');
-
I went through the script with echo "yes it works"; to figure out where the script was stopping and giving me a blank page
I had a function around my connection to the database, too, but I removed that as I went through the script and saw not a real need for it as nothing is calling the variable that it returns. I was able to connect to the database afterward, but I don't think I can do that with the rest as they return things and calls them. The other choice I suppose I have is to separate them out from that page and the paste them into each individual .php page where the variables are required in that instance.
There shouldn't be any errors at all since this was someone else's website that was working and up. I was given all the files to push up onto the server that I am on now.
_____________________
side question:
In the url if I put subdomain/domain I get an endless refreshing of a blank page so I have to do subdomain/domain/index.php to actually load the home page.
Is there a way around that as in it should directly show index.php
The alternate method of pasting sections in doesn't work well at all since other than that sql_functions.php I also have functions.php and config.php which also seems to have the issue with the script breaking when there is a function
and none of variables such as these seem to work -
$title=$_POST["title"];
-
$ac_type=$_POST["ac_type"];
-
$brief_desc=$_POST["brief_desc"];
-
$description=$_POST["description"];
-
$tech_specs=$_POST["tech_specs"];
-
as nothing is showing when I echo -
<? echo($ac_type) ?> <? echo($title)?> <? if ($brief_desc != '') { ?>(<? echo($brief_desc)?>) <? } ?>
-
Markus 6,050
Recognized Expert Expert @koager
Can I see your fully revised copy of the source code now please?
To your second question, depending on your server, you can set the default landing page(s) if one isn't provided. However, you'll have to ask in the relevant server forum.
Nothing was really revised as I was just messing around with the code trying to get things to work but then just reverting it back as things were still breaking
on my sql_function.php I have -
function dbl_connection() {
-
// Define variables to use from global context
-
global $db1_name, $db1_host, $db1_user_name, $db1_password, $connection1, $connection2;
-
-
$connection1 = @mysql_connect("mysql.example.com", "helipodmysql", "passwd");
-
if (!$connection1) {
-
die( "<P>Unable to connect to the database server at this time...<br>" . mysql_error() . "</P>" );
-
exit();
-
}
-
-
// Select the database
-
if (! @mysql_select_db("helipodmysql") ) {
-
echo( "<P>Unable to locate the database at this time.</P>" );
-
exit();
-
}
-
return $connection1;
-
}
-
-
function db1_select_query($sql) {
-
// Always query db1
-
db1_connection();
-
$res = mysql_query($sql);
-
if (!$res) {
-
echo("<P>Error performing query select: " . mysql_error() . "</P>");
-
exit();
-
}
-
db_close_connection1();
-
return $res;
-
}
-
-
function get_complete_record($id) {
-
// Declare Varibles Global or outside the function
-
global $product_id, $title, $ac_type, $brief_desc,
-
$description,$expiry_date, $tech_specs;
-
-
if ($id == '') {
-
$sql = "select * from product where product_id = '" . $_GET['product_id'] . "'";
-
} else {
-
$sql = "select * from product where product_id = '" . $id . "'";
-
}
-
-
if ($debug) echo ($sql);
-
-
-
$result = db1_select_query($sql);
-
-
// $result equals the number of rows effected
-
// It should always equal 1
-
if (mysql_numrows($result) == 0) {
-
// Session not established
-
return false;
-
exit();
-
}
-
-
// Populate Variables
-
$product_id=mysql_result($result,0,"product_id");
-
$title=mysql_result($result,0,"title");
-
$ac_type=mysql_result($result,0,"ac_type");
-
$brief_desc=mysql_result($result,0,"brief_desc");
-
$description=mysql_result($result,0,"description");
-
$tech_specs=mysql_result($result,0,"tech_specs");
-
-
// Close up result set
-
mysql_free_result($result);
-
return true;
-
}
-
ect...with more functions
and then on the actual page such as my details.php I have -
<?php
-
include("inc/header_functions.php");
-
-
$record_exists = get_complete_record($_GET['id']);
-
-
?>
-
<? include 'header.php'; ?>
-
-
-
<table cellspacing="15" class="Table" align="center">
-
<tr>
-
<td class="FieldsHeading" colspan="2">
-
<? echo($ac_type) ?> <? echo($title)?> <? if ($brief_desc != '') { ?>(<? echo($brief_desc)?>) <? } ?>
-
</td>
-
</tr>
-
<tr>
-
<td class="FieldText" align="left" valign="top" width="50%">
-
<? echo($description)?>
-
</td>
-
<td class="FieldText" align="center" valign="middle" >
-
<? if (file_exists($pic_uploaddir . "prod_" . $product_id . "_pic_0.JPG")) { ?>
-
<img src="/img/product/prod_<? echo $product_id; ?>_pic_0.JPG" />
-
<? } else { echo " "; } ?>
-
</td>
-
</tr>
-
<tr>
-
<td class="FieldLabel" align="right" valign="top" width="50%">
-
<? if (file_exists($pic_uploaddir . "prod_" . $product_id . "_pic_1.JPG")) { ?>
-
<img src="/img/product/prod_<? echo $product_id; ?>_pic_1.JPG" />
-
<? } else { echo " "; } ?>
-
</td>
-
<td align="center" valign="middle">
-
<? if ($tech_specs != '') { ?>
-
<table width="100%">
-
<tr><td colspan="2" class="TechSpecs">Technical Specifications</td></tr>
-
<tr><td width=150> </td><td> </td></tr>
-
<? echo($tech_specs)?>
-
</table>
-
<? } else { echo(" "); }?>
-
<table><tr><td align="center"><a class="DealersLink" href="/dist_results.php" >Locate a Dealer</a></td></tr></table>
-
</td>
-
</tr>
-
<? if (file_exists($pic_uploaddir . "prod_" . $product_id . "_pic_2.JPG")) { ?>
-
<tr>
-
<td> </td>
-
<td class="FieldLabel" align="center" valign="top" width="50%">
-
<a class="" href="/certs.php?product_id=<? echo($product_id); ?>" >Click here for<br>Certifications and Approvals</a>
-
</td>
-
</tr>
-
<? } ?>
-
</table>
-
<br>
-
-
<? include("footer.php"); ?>
-
where header.php has include function.php which consists of more functions and also include sql_functions.php and config.php
(from functions.php) -
function populate_var_from_post() {
-
global $product_id, $title, $ac_type, $brief_desc, $description, $tech_specs;
-
-
//$product_id=$_POST["product_id"];
-
$title=$_POST["title"];
-
$ac_type=$_POST["ac_type"];
-
$brief_desc=$_POST["brief_desc"];
-
$description=$_POST["description"];
-
$tech_specs=$_POST["tech_specs"];
-
}
-
and ect with more functions setting things
What I mainly don't understand is if it all worked perfectly before, the website should work after I uploaded the MySql database exactly as they had it, since I just imported a file, and then changed host, username, and password so that it can connect and pull the information that is needed
Sign in to post your reply or Sign up for a free account.
Similar topics
by: David Walker |
last post by:
Hi again
As I'm developing my site, i've come across a problem with the database use.
While developing it I only have mySQL, but the final server has msSQL. I
was thinking about using all my own...
|
by: David MacQuigg |
last post by:
I'm not getting any feedback on the most important benefit in my
proposed "Ideas for Python 3" thread - the unification of methods and
functions. Perhaps it was buried among too many other less...
|
by: Unregistered |
last post by:
I am very new to javascript, but I am trying to write a script that wil
that will be in a pop-up window with a form after the user hits
submit button at the bottom I want that current pop-up to...
|
by: knocte |
last post by:
Hello.
I am a web developer very worried about "bloat code" and "languages
mixture". So, since some time, I always try to avoid completely the use
of javascript in XHTML/HTML files. This leads...
|
by: PTS |
last post by:
I am working on a program that will calculate some numbers. As an
example, I will say student average test score and print out the grade
but my question is how do I put AVERAGE and test score and...
|
by: Jay Balapa |
last post by:
Hello,
I posted this under security and there were no replies.
We have a website running ASP.Net 1.1 using forms authentication and even
protects .htm/.doc files. We have associated such files...
|
by: Jay Balapa |
last post by:
Hello,
I posted this under general group and no replies.
We have a website running ASP.Net 1.1 using forms authentication and even
protects .htm/.doc files. We have associated such files to...
|
by: kwenterprise |
last post by:
Hello All,
I am normally great at figuring out ways around iframe issues that frustrate us all.
I am using javasript to try and break an iframe that I have a banner rotator embedded in but it...
|
by: Mike |
last post by:
Hi,
I took an interest a few months ago in an anti framebreaker
javascript. All my research told me that it was impossible. If a
website is loaded into a frame/iframe then if it has frame...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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...
|
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,...
|
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...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
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...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |