paulkd 59 Newbie Poster

Can you change this scenario

  • form displays - has a value of "1" in field
  • user changes "1" to "2"
  • submits form
  • form displays - has a value of "2" in field
  • user changes "2" to "3"
  • submits form
  • form displays - has a value of "3" in field

etc..

paulkd 59 Newbie Poster

Hi,

They look very similar to me in all but IE7.

But, may I make some suggestions about the layout?

Remove the "Store Number" line, and if you are not too fussed about the numbers lining up vertically put them to the right of the city e.g. Alabama (205)567-7843.

Remove the "By" and just list Phone: (nnn)nnn-nnnn, Email: xxx@xxx.xxx.

Remove the "By search engine" and just link the search engine name in your list e.g. 1. Google, 2 Bing.

paulkd 59 Newbie Poster

Hi,

I'm not understanding what your goal is, so wondering if it can be achieved without looping.
Can you explain some more scenarios of the makeup of your strings (haystacks) and chars (needles)?

paulkd 59 Newbie Poster

Are you looking to store a "history" of the value changes or to simply continue to overwrite them with each form submission?

paulkd 59 Newbie Poster

justzamir, pixelsoul's question was

What exactly is it that is supposed to happen when you hover the image

Do you want a different image to appear instead of the panda?

paulkd 59 Newbie Poster

Apologies, but I'm a big fan of jQuery. There are many solutions to problems. Here is a quick jQuery one.

<div id="test">
    <h2>Test</h2>
    <h2>change this text</h2>
</div>
<button type="button" onclick="loadXMLDoc('test1.txt')">Message 1</button>
<button type="button" onclick="loadXMLDoc('test2.txt')">Message 2</button>
<button type="button" onclick="loadXMLDoc('test3.txt')">Original</button>
<p id="colour-buttons">
    <button>Red</button>
    <button>Blue</button>
    <button>Black</button>
</p>


$(document).ready(function() {

    var colour = {
        'Red': '#B22222',
        'Blue': '#3063A5',
        'Black': '#000000'
    };

    $("#colour-buttons").on("click","button",function(){
        $("#test").css({color:colour[$(this).text()]});
    });

});

It's a little dirty, but if I knew how the project was going to grow, I would change :)

paulkd 59 Newbie Poster

Have you thought about using a GUI - e.g toad or workbench ?

http://www.toadworld.com/Default.aspx

http://www.mysql.com/products/workbench/

and just run the script from within.

savedlema commented: Thanks. What would the script for use on Workbench look like? Same as this? I hope not. But, I actually need the working script because I want to put it in the application that I'm developing with VB.NET. So I need the script so much to take with me. +2
paulkd 59 Newbie Poster

<embarrassed/>

paulkd 59 Newbie Poster

This HTML looks like Click Here

<!DOCTYPE html>
<html>
<head>
<script>
function displayResult()
{
var table=document.getElementById("myTable");
var row=table.insertRow(0);
var cell1=row.insertCell(0);
var cell2=row.insertCell(1);
cell1.innerHTML='<input name="myinput" type="input">';
cell2.innerHTML="New";
}
</script>
</head>
<body>

<table id="myTable" border="1">
  <tr>
    <td>cell 1</td>
    <td>cell 2</td>
  </tr>
  <tr>
    <td>cell 3</td>
    <td>cell 4</td>
  </tr>
</table>
<br>
<button type="button" onclick="displayResult()">Insert new row</button>

</body>
</html>

Code updated with an input in the table cell

paulkd 59 Newbie Poster

CI and other frameworks help you organise your PHP code.

People have built blog applications and CMS's using PHP, and some have probably used CI as a means to keep their code logically arranged (didn't want to use organise twice ;-) ).

I have created a PayPal class on a non-CI site and expect to easily incorporate the code into future CI sites.

paulkd 59 Newbie Poster

@broj1 No worries. I haven't made the move yet.

ibn sumal's SQL is still incorrect.

From the docs...
Procedural style: string mysqli_real_escape_string ( mysqli $link , string $escapestr )
presumably the cause of the warning.

paulkd 59 Newbie Poster

All the things I said before are still relevant.

Here is some more untested "test" code.

<?php
//create the connection between the form and the server
include('connectFileProject.php');

//test vars
$username = 'paulkd';
$_POST['warranty'] = '1';
$_POST['delivery'] = 'second';
$_POST['price'] = '10';

$sql = sprintf("
    INSERT INTO order (
        username, warranty, delivery, price
    ) values (
        '%s', '%s', '%s', %.2f
    )
    ",
    mysql_real_escape_string($username),
    mysql_real_escape_string($_POST['warranty']),
    mysql_real_escape_string($_POST['delivery']),
    mysql_real_escape_string($_POST['price'])
);
$result = mysql_query($sql);  //perform the action
?>
<html>
    <head><title>Test</head>
    <body>
        <p>Did a record get inserted?</p>
    </body>
</html>

I think you are also misunderstanding what constitutes a value in your Price field, and possibly the other fields also.

paulkd 59 Newbie Poster

Very happy with CodeIgniter 2+
May attempt to learn Laravel 4 some time in the future.

paulkd 59 Newbie Poster

In your form your price field does not contain an actual numeric - only the string "price"
Your sql is not sure whether it is an insert (INSERT) or an update (SET)
You need to add validation

Here is some untested code to try and help you along. You will probably have to change $_SESSION['username'] to whatever a logged in username variable looks like.

$sql = sprintf("
    INSERT INTO order (
        username, warranty, delivery, price
    ) values (
        '%s', '%s', '%s', %.2f
    )
    ",
    mysql_real_escape_string($_SESSION['username']),
    mysql_real_escape_string($_POST['warranty']),
    mysql_real_escape_string($_POST['delivery']),
    mysql_real_escape_string($_POST['price'])
);
broj1 commented: True +9
paulkd 59 Newbie Poster

Potentially that's a very large selection.

paulkd 59 Newbie Poster

Are you able to provide the HTML code?

paulkd 59 Newbie Poster

Your sendmail_from should be in quotes.

paulkd 59 Newbie Poster

Your logic is a little off.
If your input box is 100 and your subtract that value from itself - that will be zero.
There needs to be a Balance field as well as a field that is containing the value to subtract from the Balance.

paulkd 59 Newbie Poster

Do you have existing code that you can show?

paulkd 59 Newbie Poster

At line 6 (just before the error) add

if(!$result) {
    echo mysql_error();
    die;
}

to see what error is being reported

paulkd 59 Newbie Poster

What is the result of

<?php 
    die($Geneprocess); 
?>
paulkd 59 Newbie Poster
paulkd 59 Newbie Poster

Again, untested.

<?php
$conn=mysql_connect("localhost","root","1");
mysql_select_db("society",$conn);

$query = sprintf("
    select id, title, content, pic, date
    from news where id = %d
    ",
    mysql_real_escape_string($_GET['id'])
);
$rs = mysql_query($query,$conn);
//echo mysql_error(); die;

$row = mysql_fetch_assoc($rs);
?>
<a style="color: red;" href="newspage.php?id=<?php echo $row['id']?>"><?php echo $row['title']?></a>
paulkd 59 Newbie Poster

What are the database column names that you are displaying from your database? I'm guessing the first column is "id" what is the name of the second column?

paulkd 59 Newbie Poster

Hmm,

$conn=mysql_connect("localhost","root","1");
mysql_select_db("society",$conn);
$strSQL = "SELECT * FROM news WHERE id=" . $_GET["id"];
$result = mysql_query($strSQL,$conn);
$row = mysql_fetch_array($result);

<a style="color: red;" href="newspage.php?id=<?php echo $row[0]?>"><?php echo $row[1]?></a>
paulkd 59 Newbie Poster

Hi,

You also specificed $rows in your output instead of $row

$conn=mysql_connect("localhost","root","1"); mysql_select_db("society",$conn); $strSQL = "SELECT * FROM news WHERE id=" . $_GET["id"]; $result = mysql_query($strSQL,$conn); $row = mysql_fetch_array($result);

and

<a style="color: red;" href="newspage.php?id=<?php echo $row[0]?>"><?php echo $row[1]?></a>

I haven't done any proper testing. I also prefer mysql_fetch_assoc with $row['fieldname'] and good practice suggests not using select *

:-)

paulkd 59 Newbie Poster

Hi,

How do you know which option should be selected for each page load?

paulkd 59 Newbie Poster

Hi,

Without looking at your code in detail I can see that you haven't executed the query.

e.g. $result = mysql_query($strSQL,$conn);

before your mysql_fetch_array line.

paulkd 59 Newbie Poster
paulkd 59 Newbie Poster

Hi,

Syntax error :-)

setTimeout(function(){alert("my message");location.replace("/new-page.php");},1000);

paulkd 59 Newbie Poster

Hi,

How many names are there?

paulkd 59 Newbie Poster