Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8356937
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T10:19:54+00:00 2026-06-09T10:19:54+00:00

I am using Php to insert values into MySQL table. What i am trying

  • 0

I am using Php to insert values into MySQL table.

What i am trying to do is:
There are three columns that i have to check. ‘namel1’, ‘namel2’ and ‘namel3’.

Conditions:

  • If ‘$name’ does’t exist in any of the three column then put value in ‘namel1’.
  • If ‘$name’ exist in ‘namel1’ then put value in ‘namel2’ and if ‘namel2’ contains the value then put it in ‘namel3’.

My current MySQL query to insert name and image path is this i want to modify it to meet above conditions:

$chk_img_db = mysql_query("select * from cvapptable where img_path='$cvh_myimg_url'");
if(mysql_num_rows($chk_img_db)<1) {
mysql_query("insert into cvapptable(namel1,img_path) values ('$name','$cvh_myimg_url')");
}

I unable to get any solution from web.
Please help. Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T10:19:55+00:00Added an answer on June 9, 2026 at 10:19 am

    It’s not easy to find on the net because it’s a situation you shouldn’t get yourself into.

    You should consider normalizing the table.

    Instead of having a table with the columns:

    cvapp: id | img_path | namel1 | namel2 | namel3
    

    Consider changing it to two tables:

    cvapp: id | img_path
    names: id | cvapp_id   | name
    

    To then select every name, you just do a query like so:

    SELECT name
      FROM cvapp INNER JOIN names on cvapp.id = names.cvapp_id
     WHERE <condition>
    

    That way, you can have as many names as you want, and it’s much easier to insert a new one:

    INSERT INTO names (cvapp_id, name) VALUES (56, "Name 1");
    INSERT INTO names (cvapp_id, name) VALUES (56, "Name 2");
    INSERT INTO names (cvapp_id, name) VALUES (56, "Name 3");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a lot of text to insert into a MySQL table using PHP.
I'm trying to insert text into a MySQL DataBase from a form using PHP.
I am using this code to insert some values in MySql table: <?php mysql_connect(localhost,root,root);
I'm using the PHP PDO's to insert and update values in a table. The
I am trying to run a mysql insert query using php exec with parameters.
So I'm using PHP/MySQL and I have a tbl_profile table with the following fields:
I want to insert mutiple rows in mysql table using php. Data is in
I have a MySQL database/table set up and a .php file online that inserts
I am trying to insert data in table in mysql database through php code
I am trying to create some pages using PHP / MySQL. My database table

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.