![](https://forums.phpfreaks.com/uploads/set_resources_1/84c1e40ea0e759e3f1505eb1788ddf3c_pattern.png)
cearlp
-
Posts
17 -
Joined
-
Last visited
Posts posted by cearlp
-
-
Is an error obvious in the following code. It worked okay until just recently.
Could a Ubuntu update to 22.04 have changed something i neew to change in the PHP coding?
body { font-family: Georgia, "Times New Roman", Times, serif; color: maroon; background-color: #daa520 } h2 { padding-left: 8em } p { font-size: 13.5pt; text-indent: 5em } a:link { color:blue; text-decoration: none } a:visited { color:purple; text-decoration: none } </style> <script language=javascript> function Validate() { if (document.form1.password.value == "fredpeabody") { window.location="<?php echo 'sxdisp.php'; ?>"; return(false); } else { window.location="<?php echo 'sxdispunprotect.php'; ?>"; return(false); } } </script> </head> <body onLoad="self.focus();document.form1.password.focus()" > <div id="main-content"> <p> Enter the Password to search and display all the information on the Sigma Database. </p> <p> Otherwise only the unprotected information will be displayed.</p> <form name="form1" method="post" action="<?php echo $_SERVER['PHP_SELF']?>" onsubmit="return Validate()"> <table width="1000" border="0" cellspacing="1" cellpading="0"> <tr> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td align="right">Password: </td> <td><input size="20" maxlength="20" name="password" value=" "> </td> </tr> </table> </form> </div> </body>
-
Thank you mac_gyver... Finding out the errors showed me that it was a connection to the database that failed due to a password change that was not accounted for in the code.
-
I tried the following after researching mysqli exceptions and the result was the same,,,first two echos are displayed, no error printout but the echo "after conn" was not displayed.
function conn($sql)
{$host = "localhost";
$user = "root";
$pass = "xxx"; valid root password for database
$db = "xxx"; looking at database with PHPMYADMIN seems okayecho "in conn--- ";
echo "HOST $host, USER $user, PASS $pass, DB $db";$con = new mysqli($host, $user, $pass, $db);
if ($con->connect_errno) {
printf("connect failed: %s\n" , $con->connect_error());
exit();
}echo "after conn";
}
-
No error or any message. The program seems to finish normally except nothing was available to be displayed from the database. The code:
if (!($conn=mysqli_connect($host, $user, $psss, &db))) {
printf("error connecting to DB by user = $user");
exit;
}
-
After years of working, the call to mysql_connect does nothing.
Software installed is:
Server: Localhost via UNIX socket
Server type: MariaDB
Server version: 10.6.18-MAriaDB-0ubuntu0.22.04.1
Protocol version: 10
Apache/2.4.52 (Ubuntu)
Database client version: libmysql - mysqlind 8.1.2-1ubuntu2.18
PHP extension: mysqli curl mbstring
PHP version: 8.1.2-1ubuntu2.18
What have I missed, some update or could the database be corrupted?
-
My BAD! The code is mysqli_error() not mysql_errno(). BUT, adding the $conn to the mysqli_error($conn) produces a valid and informative error message.
Many thanks for the help.
-
Two identical php programs doing a mysqli_query, but on different databases. One succeeds and the other fails. The one that fails returns no errno.
Could the cause be the databases?
If so, what could be the problem? They are real similar in construction, one has more fields than the other, but almost the same data in both.
$conn = use, passwd, database
$sql = insert into members (name,addr,city,state) values('Joe','123 St','Somecity','CA')
$result = mysqli_query($conn, $sql) or die (Can't run query because " . mysql_errno());
-
Thanks, I will post to the javascript forum.
-
I wasn't looking at it that way. My flow is like this:
As stated, the function is in the <head> section of the file. A form is displayed and if the submit button is selected the page reloads itself. If isset($_POST['submit'] is true certain fields are checked for being blank. If they are, an alert box is displayed and the form is re-displayed with the data that has already been filled in. If the fields are not blank processing continues and later in the process flow a database is going to be updated. At this point I want to call a confirm function to display a confirm box and need the response of either OK or Cancel to either continue the update or re-display the form.
Does this make sense?
-
I define a Javascript in the <head> section of a .php file and call it from the <body> section with the following:
echo "<script language='javascript'>function();</script>".
The function displays a confirm box with the normal Cancel and OK buttons just fine, but I want to capture the function return of true or false for which button was selected.
So far I haven't found a way to get return a value from the function. Any ideas???
-
Thanks for the help Crayon Violent. I can get by be calling the script with onsubmit but can a javascript be called from anywhere in a php script?
-
I have a php script that creates an HTML form and then gets input from the submission of that form. Is it possible for the php script to display some sort of confirmation request and then receive input from the keyboard in response to the request before processing the data that was input via the form?
I hope this question make sense?
Thanks in advance.
-
Responding to the two previous replies --- A port checker shows on;y port 80 as being active (naturally since I am using http to run the port checker ) and I know sendmail.dll is not a mailserver but I thought since I only have Outlook Express as a mail program (it's never used though it is installed) it might be using sendmail.dll and tying up port 25.
-
I am running XP so I have a sendmail.dll but I don't know if anything else is using port 25.
Is there a way to out?
-
In my php.ini fille I have SMTP = localhost, smtp_port = 25 and sendmail_from = me@localhost
Running my php script gives me the following error:
Warning: mail() [function.mail] Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\Program Files\Apache2.2\htdocs\mail-comments.php on line 29.
I have tried several different ini_set("sendmail_from", "xxx@yyy.com") lines in the php script but always get the same error. Is there something specific about the sendmail_from variable that I am overlooking?
-
Hello,
Don't know if this is the correct forum for my question but here goes...
I use PHP within an html file to generate table data. The table data are links and by default they are underlined. I want to eliminate the underlining and have tried to do this using CSS and a rule for anchors. Ex: a {text-decoration: none;} This does not work and I can only think that it is because the <td>.....</td> is generated with an echo statement in PHP.
Here is the code:
echo "<tr style='background color:$bgcolor;'><td><a href='".$_SERVER['PHP_SELF']."?memberid=$id'>$name</a></td></tr>";
The html page is rendered correctly and the links work as planned. I just want to get rid of the underlines under the name.
Any thoughts?
what is the error?
in PHP Coding Help
Posted
Thanks all for the replies.